Cygwin: 2 problems detected by the test suite #437

Open
ampli opened this Issue Oct 3, 2016 · 3 comments

Comments

Projects
None yet
3 participants
Member

ampli commented Oct 3, 2016

These are recently-added tests, that I have not tried on Cygwin before.
1).

FAIL: test_regex_class_shortcut_support (__main__.DBasicParsingTestCase)
Test that regexes support \w
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/src/link-grammar-devel/cygwin/bindings/python-examples/tests.py", line 301, in test_regex_class_shortcut_support
    self.assertEqual(linkage.word(4), '_regex_ive[!].a')
AssertionError: '_regex_ive[?].n' != '_regex_ive[!].a'

It just seems the POSIX regex library of Cygwin (a BSD one) doesn't support \w and most probably other backslash escapes (since maybe they are extensions to POSIX). By a fast glance in the library code I was not able to identify such a support.

Possible fixes:

  1. Send the Cygwin developers a PR to add the missing escapes (but I am not going to do that).
  2. Add C++ regex implementation, to be used only[*] when proper C POSIX regex is not available (such as on Cygwin and MSVC - MinGW has not been checked for that since the Python bindings still not wor implemented there) . [*] If it fast enough it can replace the current code, as already discussed.
  3. Add an option for PCRE. (should not be hard since it has POSIX compatibility functions so probably only linking to it is needed).

2).
This one is alarming. My recent fix to allow to parse with any number of null-links, starting with 0, seems not to work on Cygwin. I tried with no optimization and the problem persists.
Unless this is a compiler bug on Cygwin (not likely) it may hint the code has some "undefined behavior" bug (e.g. uninitialized variable).

Since the result is different, it means it is more probably easy enough to find the exact point in which it happens. But it may take some time.

The relevant code needs a close inspection anyway - it either containing an unneeded heavy call at the start (free_parse_info()), or free_parse_info() needs to be repeated after every failed parsing. What I couldn't understand yet is how come that removing the said call to free_parse_info() doesn't mangle the results in any way (checked on Linux) even when the parse_info structure contains info from a a previous (unsuccessful) parse.

FAIL: test_null_link_range_starting_with_zero (__main__.ZENLangTestCase)
Test parsing with a minimal number of null-links, including 0.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/src/link-grammar-devel/cygwin/bindings/python-examples/tests.py", line 516, in test_null_link_range_starting_with_zero
    self.assertEqual(len(linkages), 2)
AssertionError: 1 != 2
Contributor

jbicha commented Oct 4, 2016

The test suite fails on Debian and Ubuntu too.

https://autopkgtest.ubuntu.com//packages/link-grammar/yakkety/amd64
https://ci.debian.net/packages/l/link-grammar/unstable/amd64/

I think I need to rewrite the autopkgtest rule so it prints a more useful error.

Member

ampli commented Oct 4, 2016

The test suite actually passes. However, there is another strange problem (from the recent last log in the first link). Does your script remove link-grammar/liblink-grammar.la?

make  check-TESTS
make[1]: Entering directory '/tmp/autopkgtest.AfVMH6/build.yYs/link-grammar-5.3.11/bindings/python-examples'
make[2]: Entering directory '/tmp/autopkgtest.AfVMH6/build.yYs/link-grammar-5.3.11/bindings/python-examples'
make[1]: *** No rule to make target '../link-grammar/liblink-grammar.la', needed by 'dict-reopen'.  Stop.
make: *** [check-am] Error 2
PASS: tests.py
============================================================================
Testsuite summary for link-grammar 5.3.11
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[2]: Leaving directory '/tmp/autopkgtest.AfVMH6/build.yYs/link-grammar-5.3.11/bindings/python-examples'
make[1]: Leaving directory '/tmp/autopkgtest.AfVMH6/build.yYs/link-grammar-5.3.11/bindings/python-examples'
make: Leaving directory '/tmp/autopkgtest.AfVMH6/build.yYs/link-grammar-5.3.11/bindings/python-examples'
autopkgtest [19:45:11]: test unit-tests: -----------------------]
autopkgtest [19:45:12]: test unit-tests:  - - - - - - - - - - results - - - - - - - - - -
unit-tests           FAIL stderr: make[1]: *** No rule to make target '../link-grammar/liblink-grammar.la', needed by 'dict-reopen'.  Stop.
autopkgtest [19:45:12]: test unit-tests:  - - - - - - - - - - stderr - - - - - - - - - -
make[1]: *** No rule to make target '../link-grammar/liblink-grammar.la', needed by 'dict-reopen'.  Stop.
make: *** [check-am] Error 2
autopkgtest [19:45:13]: @@@@@@@@@@@@@@@@@@@@ summary
unit-tests           FAIL stderr: make[1]: *** No rule to make target '../link-grammar/liblink-grammar.la', needed by 'dict-reopen'.  Stop.
Exit request sent.
Contributor

jbicha commented Oct 5, 2016

Thanks. Yes the Debian test suite failure was just a packaging problem and is fixed now. I also confirm that the fix for issue #428 works.

@ampli ampli added the bug label Oct 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment