Hi Alexis,

On Sun, Sep 20, 2015 at 7:48 PM, Alexis <surryh...@gmail.com> wrote:

> Hello Bruce,
> > Here's the output for all of the failing tests. Not sure what's going on
> > with the "WARNING: Empty testfile detected" errors.
>
> I've added the code below to test/RegressTests.py a little while ago:
>   line = self.fd.readline() # self.fd is a file object created with open()
>   if not line:
>     print >>sys.stderr, "WARNING: Empty testfile detected: %s" %
> (self.filename)
>     return False
>
> I thought it would only fail for testfiles that are empty,
> as it seems that is not the case.
>
> I wonder what readline() returns that the `if not line:` test succeeds,
> even though the file isn't empty.
>

It looks to me like that 'if not line' test is invalid... consider
read_test() is called from a loop inside run_tests(). Eventually it hits
the end of the file and the readline() test fails. That has no bearing on
whether the test case is passing or failing. Consider this verbose ctest
output:

$ ctest --verbose --output-on-failure -R 012ADB60
UpdateCTestConfiguration  from
:/c/Users/schultzb/src/ledger/DartConfiguration.tcl
UpdateCTestConfiguration  from
:/c/Users/schultzb/src/ledger/DartConfiguration.tcl
Test project /c/Users/schultzb/src/ledger
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 215
    Start 215: RegressTest_012ADB60

215: Test command: /usr/bin/python2.7.exe
"/c/Users/schultzb/src/ledger/test/RegressTests.py"
"/c/Users/schultzb/src/ledger/ledger.exe" "/c/Users/schultzb/src/ledger"
"/c/Users/schultzb/src/ledger/test/regress/012ADB60.test"
215: Environment variables:
215:  TZ=America/Chicago
215: Test timeout computed to be: 9.99988e+06
215: .
215: OK (1)
215: WARNING: Empty testfile detected:
/c/Users/schultzb/src/ledger/test/regress/012ADB60.test
1/1 Test #215: RegressTest_012ADB60 .............   Passed    0.73 sec

The following tests passed:
        RegressTest_012ADB60

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.83 sec

This is a passing test, but the warning is still there...


$ ctest --verbose --output-on-failure -R 3FE26304
UpdateCTestConfiguration  from
:/c/Users/schultzb/src/ledger/DartConfiguration.tcl
UpdateCTestConfiguration  from
:/c/Users/schultzb/src/ledger/DartConfiguration.tcl
Test project /c/Users/schultzb/src/ledger
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 251
    Start 251: RegressTest_3FE26304

251: Test command: /usr/bin/python2.7.exe
"/c/Users/schultzb/src/ledger/test/RegressTests.py"
"/c/Users/schultzb/src/ledger/ledger.exe" "/c/Users/schultzb/src/ledger"
"/c/Users/schultzb/src/ledger/test/regress/3FE26304.test"
251: Environment variables:
251:  TZ=America/Chicago
251: Test timeout computed to be: 9.99988e+06
251: .
251: E[3FE26304.test]
251: OK (1)  FAILED (1)
251: WARNING: Empty testfile detected:
/c/Users/schultzb/src/ledger/test/regress/3FE26304.test
1/1 Test #251: RegressTest_3FE26304 .............***Failed    1.30 sec
.
E[3FE26304.test]
OK (1)  FAILED (1)
WARNING: Empty testfile detected:
/c/Users/schultzb/src/ledger/test/regress/3FE26304.test


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   1.40 sec

The following tests FAILED:
        251 - RegressTest_3FE26304 (Failed)
Errors while running CTest


This is from one of the problem tests. In this case there are 2 tests in
the .test file. It looks like one passes, the other fails. Unfortunately
the only output from the test is the empty testfile warning. But its not
empty, and I've added enough print line statements to convince myself that
it has read the whole file correctly. so its something else. I'll keep
digging...


> In a previous message you mentioned Python 2.7.10 is used on Cygwin,
> I use the same version on Mac OS X 10.11 El Capitan, yet I do not see
> the issues.
>

What if you try the verbose output for one of the tests as above?


>
> Maybe you could rerun the tests with the following slight modification
> of test/RegressTests.py to aid in debugging:
>   line = self.fd.readline() # self.fd is a file object created with open()
>   if not line:
>     print >>sys.stderr, "WARNING: Empty testfile detected: %s »%s«" %
> (self.filename, line)
>     return False
>

The line was empty at that point. But it had already correctly read the
rest of the file by that stage...



>
> And just to be safe please provide the SHA256 sums of those files, e.g.:
> % $SHELL --version
> zsh 5.0.8 (x86_64-apple-darwin15.0)
> % for t in
> test/baseline/{cmd-price{s,db},feat-fixated-prices,opt-{datetime-format,gain,historical,market,price,revalued,time-report}}.test;
> do \
>   echo -n "$t: "; openssl dgst -sha256 < $t; \
> done | column -t
> test/baseline/cmd-prices.test:
>  dbee77184f7355ba172a672bd6ed21ffd3dfdc995508fdcfea8d7c61f13b4ff7
> test/baseline/cmd-pricedb.test:
> e6e8ca3e914ae90ca34b9f4ca32075af456b2526a41a7882bb6cf5bc11d9b45c
> test/baseline/feat-fixated-prices.test:
> 0d7040bd96d527345c890b3844382893afecece997957291de2208c053c56fd5
> test/baseline/opt-datetime-format.test:
> 2acaef081ad742ae1ad05544e08ad863ed539599d717e5195ef15c9beebae3b3
> test/baseline/opt-gain.test:
>  36b11c393ee915cedcbf7c9d6eafdbce3c22c30e0cc68f0e4810926ebfec4155
> test/baseline/opt-historical.test:
>  6a408b24917e409fdf18745f708eaa7e94b3ed95700cc9e98ae9c0194b7823bf
> test/baseline/opt-market.test:
>  110ce3bf772460149b4832090b630fc71df55bdd54ef1fa38daf76ed1f6cb6c1
> test/baseline/opt-price.test:
> 0dad7401c8e28bf9a604c5f2cab52a4ed9c4ea61827a519649b3979c0ddaf8f0
> test/baseline/opt-revalued.test:
>  e8792ae0bc1b47e4d2d76851a122944be7d89eb65a2be0493b227be1c4337d72
> test/baseline/opt-time-report.test:
> 87582cbb559735558bc9041ab53517d4f8e187bafa550fe41843bdd0935cbbcd
>
> Almost the same:
test/baseline/cmd-prices.test:           (stdin)=
dbee77184f7355ba172a672bd6ed21ffd3dfdc995508fdcfea8d7c61f13b4ff7
test/baseline/cmd-pricedb.test:          (stdin)=
e6e8ca3e914ae90ca34b9f4ca32075af456b2526a41a7882bb6cf5bc11d9b45c
test/baseline/feat-fixated-prices.test:  (stdin)=
0d7040bd96d527345c890b3844382893afecece997957291de2208c053c56fd5
test/baseline/opt-datetime-format.test:  (stdin)=
282dad662f13bc3a7f895cfb4e217688e8f4fcaf7d11e690b4380aca2ed19b6d
test/baseline/opt-gain.test:             (stdin)=
36b11c393ee915cedcbf7c9d6eafdbce3c22c30e0cc68f0e4810926ebfec4155
test/baseline/opt-historical.test:       (stdin)=
6a408b24917e409fdf18745f708eaa7e94b3ed95700cc9e98ae9c0194b7823bf
test/baseline/opt-market.test:           (stdin)=
110ce3bf772460149b4832090b630fc71df55bdd54ef1fa38daf76ed1f6cb6c1
test/baseline/opt-price.test:            (stdin)=
0dad7401c8e28bf9a604c5f2cab52a4ed9c4ea61827a519649b3979c0ddaf8f0
test/baseline/opt-revalued.test:         (stdin)=
e8792ae0bc1b47e4d2d76851a122944be7d89eb65a2be0493b227be1c4337d72
test/baseline/opt-time-report.test:      (stdin)=
87582cbb559735558bc9041ab53517d4f8e187bafa550fe41843bdd0935cbbcd

opt-datetime-format.test is different.

I have this currently (branch is release/3.1.1)
$ git log -n 1
commit 43112565d07df99f10a0ef2d472716cd4f09c9d4
Author: Alexis Hildebrandt <a...@surryhill.net>
Date:   Tue Sep 15 17:00:04 2015 +0200

    Bump version number to 3.1.1


>  - the sort order for pricedb is different (I tried changing the input
> > order, but the output came out in a different order again)
>
> I've seen this happen in Travis CI too.
> Who has an idea what might be happening here?
>
> >  - the time report output has an extra line with a single *
>
> That's odd. If timelog entries are cleared, using a capital oh ('O')
> for the check-out time,they are marked with an asterisk ('*') in the
> output.
> But none of the entries in the opt-datetime-format.test are cleared.
>
> Basically the --time-report option is just an alias for the
> --balance-format option with a pre-defined format string.
> The code can be found in src/report.h:973 (ff).
>
> I'm doing some experiments to get a better idea what might be going wrong.
>

I think I've found the cause underlying the failed test case, nothing to do
with empty files... this is equivalent to the 2nd test, without the test
harness wrapping:

$ ledger -f test/regress/3FE26304.test reg -X \$ sub1 --now=2012/03/1
10-Apr-04 Opening Balance
Assets:Sub1                                           $1.00
$1.00
10-Apr-04 Opening Balance
Assets:Sub1                                        $3227.00
$3228.00
10-Apr-04 Opening Balance
Assets:Sub1                                        $1130.00
$4358.00
10-Apr-04 Opening Balance
Assets:Sub1                                        $2030.00
$6388.00
10-Apr-04 Opening Balance
Assets:Sub1:Leftovers                                 $6.79
$6394.79
10-Apr-04 Opening Balance
Assets:Sub1                                         $223.30
$6618.09
10-Apr-04 Opening Balance
Assets:Sub1                                         $297.00
$6915.09
10-May-18 FOO
Assets:Sub1                                        $5438.00
$12353.09
10-Jul-02 Commodities revalued
<Revalued>                                          $259.74
$12612.83
10-Jul-02 BAR
Assets:Sub1                                         $135.84
$12748.67

Assets:Sub1:Leftovers                                 $1.31
$12749.98
10-Sep-29 Commodities revalued
<Revalued>                                         $5251.46
$18001.44
12-Mar-01 Commodities revalued
<Revalued>                                           $25.30
$18026.74
Segmentation fault (core dumped)

So far, I haven't been able to get anything meaningful from the dump ... I
think its cygwin related. And if I try to run the test from within gdb, it
runs successfully. Smells of timing / race condition type of issue. I'll
keep at it when I can & try to get something more useful...

Bruce

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to