| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
also add unit tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
warning: equality comparison result unused [-Wunused-comparison]
BOOST_CHECK_THROW(v8 == v10, value_error);
~~~^~~~~~
|
|
|
|
| |
so that the tests run with a consistent environment.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| | |
warning: relational comparison result unused [-Wunused-comparison]
BOOST_CHECK_THROW(x6 < x7, amount_error);
~~~^~~~
|
|/
|
|
| |
by explicitly linking the testing targets against Python
|
|
|
|
|
| |
Add a space between if and the opening bracket, between a closing
round bracket and the following opening curly bracket, etc.
|
|
|
|
|
| |
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.
|
|
|