Skip to content

Commit

Permalink
Merge pull request #601 from openzim/small-test-related-improvements
Browse files Browse the repository at this point in the history
Small test related improvements
  • Loading branch information
kelson42 authored Aug 3, 2021
2 parents 38d9f60 + d5baac5 commit 947b66a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,23 @@ xapian by testing the define `LIBZIM_WITH_XAPIAN`.
Testing
-------

ZIM files needed by unit-tests are not inculded in this
repository. You must tell Meson where the test data is located.

By default, Meson will use an internal directory in your build directory.
But you can specify another directory with option `test_data_dir`:
ZIM files needed by unit-tests are not included in this repository. By
default, Meson will use an internal directory in your build directory,
but you can specify another directory with option `test_data_dir`:
```bash
meson . build -Dtest_data_dir=<A_DIR_WITH_TEST_DATA>
```

Whatever you specify a directory or not, you need a extra step to download the data. At choice:
* Get the data from the repository [openzim/zim-testing-suite](https://github.com/openzim/zim-testing-suite) and put it yourself in the directory.
* Use the script [download_test_data.py](scripts/download_test_data.py) which will download and extract the data for you.
* As `ninja` to do it for you with `ninja download_test_data` once the project is configured.
Whatever you specify a directory or not, you need a extra step to
download the data. At choice:
* Get the data from the repository
[openzim/zim-testing-suite](https://github.com/openzim/zim-testing-suite)
and put it yourself in the directory.
* Use the script
[download_test_data.py](scripts/download_test_data.py) which will
download and extract the data for you.
* As `ninja` to do it for you with `ninja download_test_data` once the
project is configured.

The simple workflow is:
```bash
Expand Down
4 changes: 2 additions & 2 deletions test/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ zim::Buffer write_to_buffer(const T& object, const std::string& tail="")
while ( size != 0 ) {
const auto size_to_read = std::min(size_type(size), size_type(INT_MAX));
const auto n = read(tmp_fd, p, size_to_read);
if ( n == -1)
throw std::runtime_error("Cannot read");
if ( n == -1 )
throw std::runtime_error("Cannot read " + tmpFile.path());
p += n;
size -= n;
}
Expand Down

0 comments on commit 947b66a

Please sign in to comment.