-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
re-add bison + flex tests #17
Comments
It's all about time and efforts vs results. I only had time to refactor flex/bison code to windows environment. As windows supports linux subsystem I hope this project will be less demanded in the future. So I don't see any reason to make this project better as it's now. But if you prefer to invest in this I think it would be valuable for the project.
Is any chance to stay within VS C++ compiler? |
I don't see this. I guess you speak about the so-called "bash on windows" but this means to install some GB just to translate bison/flex sources to C.
Depends on what you understand as "stay within". Doing the tests from VS would mean to rewrite the complete testsuite script as VS test (the "sources" for the testsuite are available, therefore this would be possible but likely time intensive [remark: I don't know very much about the VS internal test option]). Note: Even with a MinGW/cygwin shell executing the tests these would still be executed using the VS-generated win_flex and win_bison executables and would use cl.exe to compile their results. |
I meant Windows_Subsystem_for_Linux
I think it's not an option. As I understand Windows_Subsystem_for_Linux is pretty similar to MinGW/cygwin. So we could adopt tests to run using MinGW/cygwin and get possibility to run test under Windows_Subsystem_for_Linux for free. So user will have two options for tests.
I understand that. |
That is exactly what I meant - GNU/kWindows. As it is now available via Windows Store and the initial size gone down with the Debian "app" to 76MB this would be an option for people. Adding bison and flex brings in some additional MBs... Note: Your VS build rules could be adjusted to run these tools from the WSL environment (using |
No I haven't tried it. I'm kinda lazy man :) |
If it isn't possible to add the full tests soon we should at least add an example compilation. Actually the bug I've fixed with 6cfd835 is now many years old and would have raised a broken test in the debug environments (it likely had no actual bad result in production but could be seen directly after the commit). I should investigate adding the original test suites with the goal to run them on CI. If this isn't possible within a reasonable time frame I go with extracting bison/flex sources and all needed files to compile them from GnuCOBOL, run bison/flex and try to use the C compiler to compile to object files. This would at least provide some general checks. @lexxmark any thoughts about adding a test subfolder containing these files? |
Yes, please. |
The first approach to just use the 2.6.4 tests with a hand-revised Makefile and testsuite runner did not work out completely (compilation of the test programs [in Release mode] is fine but the tests aren't all run) and showed some errors. Just tested using a full-configured Cygwin environment + westes/flex@4e2a81a, this time everything compiles and runs but the same test failures are in:
As cygwin64 is part of the Appveyor environment I think about just adding clwrap.sh to the repo, then after building do something like: FLEXVER=2.6.4
wget https://github.com/westes/flex/releases/download/v$FLEXVER/flex-$FLEXVER.tar.gz
tar -xvf flex-$FLEXVER.tar.gz
cd flex-$FLEXVER
./configure
cd tests
sed -i -e 's|/dev/null|/NUL|' options.cn
make check "CC=./clwrap.sh" "CXX=./clwrap.sh -EHsc" "OBJEXT=obj" "FLEX=/cygdrive/c/projects/winflexbison/build/win_flex_bison-$APPVEYOR_REPO_TAG_NAME/win_flex.exe" "YACC=/cygdrive/c/projects/winflexbison/build/win_flex_bison-$APPVEYOR_REPO_TAG_NAME/win_bison.exe -y" Opinions? @lexxmark Can you please have a look at the currently failing tableopts tests (inspecting the posted test-suite.log)? |
Sounds good.
I'm not familiar with clwrap.sh. Could you point me where in test-suite.log file I can get command that failed and expected result. |
That's just a quick hack to translate the commands from the configured Let's inspect the test-suite.log together (I'm not familiar with the flex test-suite) and try to decipher it:
This is what I guess:
This leads us to:
To generate
This is what I've just tried on a "normal" environment with the tableopts.l4 locally available: win_flex.exe --unsafe-no-m4-sect3-escape --tables-file="tableopts_ser_nr-Ca.ser.tables" --tables-verify -o tableopts_ser_nr-Ca.ser.c tableopts.l4
rem change generated C file: comment config.h, replace <netinet/in.h> with <Winsock2.h>
cl.exe -DTEST_HAS_TABLES_EXTERNAL -DYY_NO_UNISTD_H tableopts_ser_nr-Ca.ser.c Ws2_32.lib
.\tableopts_ser_nr-Ca.ser.exe tableopts_ser_nr-Ca.ser.tables
tables verification failed at flex_int8_t I have not used generation of a tables file before this one and I have no clue how they should work, but I guess the testsuite checks that the result has an errorlevel of zero. If something is unclear or if you need more information I'd recommend to ask in the flex mailing list / flex Github issues. |
It seems like this issue related to windows EOL as well. |
EOL is not fixed for stdout/stderr, the tests are still failing. I assume you've missed something like (void)_setmode (_fileno (stdin), _O_BINARY);
(void)_setmode (_fileno (stdout), _O_BINARY);
(void)_setmode (_fileno (stderr), _O_BINARY); The part that I've previously requested was to not use binary mode by default, but only if explicit requested. Otherwise you write files with #ifdef _WIN32
/* Allows running tests under woe32 */
char *p = getenv ("USE_UNIX_LF");
if (p && (*p == 'Y' || *p == 'y' || *p == '1')) {
use_unix_lf = 1; // extern int, referenced in all places to decide for "wb" or "w"
(void)_setmode (_fileno (stdin), _O_BINARY);
(void)_setmode (_fileno (stdout), _O_BINARY);
(void)_setmode (_fileno (stderr), _O_BINARY);
}
#endif |
I have added development branch with You can modify my changes or add needed code to get tests pass. When we finish with tests we will cleanup code (add macro guard etc) and merge it to master |
@GitMensch have you checked development branch? |
Do you guys intend to use MSYS2/MinGW, or rewriting the Automake file with CTest in CMake is fine? Just that translation will be tedious as well 😅 |
The original plan was to use MSYS(2), those are available on several CIs (including Appveyor, which is currently used here), because updating would then mean to just ... update, not to rewrite again. Note: we only need the shell and maybe some autotools, the test would then run with winbison/winflex and cl.exe. |
I see the intention is to keep test automation deviation from upstream minimal... |
The first step would be to integrate the test suites back and everything that is necessary to execute them.
With bison this should be quite easy: just add the testsuite and a created atlocal script (with bison script incorporated if needed). Then all that is likely needed is a minimal MinGW/Cygwin installation + diff to execute it.
Flex seems to be a little bit more work as it doesn't use a autotest testsuite script but a self-made one based on automake. But this may also allow to run the tests with VS nmake (no unix shell interpreter needed).
With something important as the parser/tokenizer core of many systems I actually do wander why there are no tests (or did I missed something other that "the un-modified versions are tested already")...
The text was updated successfully, but these errors were encountered: