summaryrefslogtreecommitdiff
path: root/test/unit/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* format_t::truncate support wide charactersKuang-che Wu2021-01-171-1/+1
| | | | also add unit tests
* py3: ensure python output is not lostAndy Clayton2020-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unbuffer python's stdio to avoid output getting stuck in buffer when stdout is not a TTY. Normally buffers are flushed by `Py_Finalize` but Boost has a long-standing issue preventing the proper shutdown of the interpreter with `Py_Finalize` when embedded [1]. This applies the same fix as 139beba but to any ledger usage rather than only the test suite. I removed `PYTHONUNBUFFERED=1` from tests as there is no expectation that users should need to have this set for ledger to function. For example without this fix piping ledger into cat usually loses any output (unless the output is large enough to cause the buffer to flush): $ ./ledger -f "test/baseline/feat-value_py3.test" reg <class 'bool'> True [...] $ ./ledger -f "test/baseline/feat-value_py3.test" reg | cat $ Interestingly `--verify` causes `python_interpreter_t` to be destroyed -- it doesn't appear to be otherwise -- which does call `Py_Finalize`. As expected this fixes the issue but can also crash due to the boost issue mentioned above: $ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg <class 'bool'> True [...] Segmentation fault (core dumped) $ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg | cat <class 'bool'> True [...] $ 1. https://www.boost.org/doc/libs/1_62_0/libs/python/doc/html/tutorial/tutorial/embedding.html
* fix setting TZ in testsAndy Clayton2020-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was regressed in 139beba which set `PYTHONUNBUFFERED` to fix other test issues. When setting multiple environment variables in this way they need to be delimited with semicolons rather than spaces. As it is `PYTHONUNBUFFERED` is being set to `1 TZ=America/Chicago`. The CMake docs are not as clear about this as they probably should be. This can be verified by throwing together a CTestTestfile.cmake: add_test(incorrect_env "printenv" "PYTHONUNBUFFERED" "TZ") set_tests_properties(incorrect_env PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1 TZ=America/Chicago") add_test(correct_env "printenv" "PYTHONUNBUFFERED" "TZ") set_tests_properties(correct_env PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1;TZ=America/Chicago") When run with `ctest -V`: 1: Test command: /usr/bin/printenv "PYTHONUNBUFFERED" "TZ" 1: Environment variables: 1: PYTHONUNBUFFERED=1 TZ=America/Chicago 1: Test timeout computed to be: 10000000 1: 1 TZ=America/Chicago 1/2 Test #1: incorrect_env ....................***Failed 0.00 sec test 2 Start 2: correct_env 2: Test command: /usr/bin/printenv "PYTHONUNBUFFERED" "TZ" 2: Environment variables: 2: PYTHONUNBUFFERED=1 2: TZ=America/Chicago 2: Test timeout computed to be: 10000000 2: 1 2: America/Chicago 2/2 Test #2: correct_env ...................... Passed 0.00 sec
* test: Unbreak one more test case with python3 bridgeDimitri John Ledkov2019-12-061-1/+1
| | | | | | | | | | | python3 has buffered output by default, hence testcase option_py returned no output when executed under test harness. I think this is a real problem in the way python interpreter is embeded, and i.e. stdout is not flushed until after test case has died. However, running things unbuffered seems to make everything work. But for some reason I had to adjust 1057.test slightly. I have no idea what those numbers mean, and if running things unbuffered break stuff.
* Modernize CMake using backported FindPython module.Dimitri John Ledkov2019-12-051-4/+4
|
* Do not set dependencies for target checkTim Landscheidt2019-01-221-3/+0
| | | | | | The set_target_properties() commands themselves do not cause the tests to run if the target check is made, and as the target check executes ctest, all tests will be run anyway.
* [tests] Remove compiler warnings for unit testsAlexis Hildebrandt2015-09-151-1/+1
| | | | | | warning: equality comparison result unused [-Wunused-comparison] BOOST_CHECK_THROW(v8 == v10, value_error); ~~~^~~~~~
* [tests] Set timezone for running testsAlexis Hildebrandt2015-08-071-0/+2
| | | | so that the tests run with a consistent environment.
* Merge remote-tracking branch 'origin/master' into nextJohn Wiegley2015-08-041-1/+1
|\
| * add t_value unit testtripun2014-08-151-1/+1
| |
* | [tests] Remove compiler warnings for unit testsAlexis Hildebrandt2015-07-281-0/+1
| | | | | | | | | | | | warning: relational comparison result unused [-Wunused-comparison] BOOST_CHECK_THROW(x6 < x7, amount_error); ~~~^~~~
* | [tests] Fix Util and Math tests on Mac OS XAlexis Hildebrandt2015-07-281-0/+6
|/ | | | by explicitly linking the testing targets against Python
* Cosmetic change - format code consistentlyMartin Michlmayr2014-05-181-1/+1
| | | | | Add a space between if and the opening bracket, between a closing round bracket and the following opening curly bracket, etc.
* build shared library/python module, clean up CMakeJohann Klähn2014-02-011-1/+1
| | | | | libledger will now be built as a shared library. You can 'import ledger' from python IFF you copy libledger.so to ledger.so or create a symlink.
* Converted the Ledger build system to use CMakeJohn Wiegley2012-05-201-0/+17