- Notifications
You must be signed in to change notification settings - Fork1.1k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
ocamltest#681
ocamltest#681
Conversation
Did you consider using attributes instead of a custom language lexer/parser for TEST blocks? |
Alain Frisch (2016/07/11 07:59 -0700):
Well, not really so far, to be honest. I can see two questions:
Second, I have to say I am not familiar with attributes. Thus, I don't |
After reading the readme, I am not sure which tests can be converted to the ocamltest format. |
.merlin Outdated
@@ -1,56 +0,0 @@ | |||
S ./asmcomp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why remove the .merlin file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Indeed, the tests you mention cannot be migrated right now. ocamltestneeds to be extended to support msuch tests. I'lyl work on that self but forthat, too, help is welcome. |
If I understand correctly all specific makefiles would need to be rewritten within ocamltest (i.e. a new compiler-specific tool), and all tests would need to be given a specification in TSL, a new compiler-specific DSL. This seems to add quite a bit of overhead compared to the existing makefile-based situation. Could you comment in more detail what would be the advantages of such transition? |
Florian Angeletti (2016/07/11 14:31 -0700):
You are correct, except for the "compiler-specific" aspect. The tool has Not sure this reusability aspect has been reached yet, but it is at
That's correct, too.
I think there are at least a few developers who may have a different
I'd say having all the logic in one place, having it written in OCaml |
What's the plan for Windows? The AppVeyor pass is a fake: see lines 5366-5441 of the log. |
@dra27 Many thanks for your interest in this PR, David.I am very interested in making this work under Windows and welcome anyfeedback especially on this topic, given that I have no experience atall with Windows programing.Where is the log you mention visible, please? |
ocamltest/run.c Outdated
realpath_error(settings->stdout_filename); | ||
if ((realpath(settings->stderr_filename, stderr_realpath) == NULL) && (errno != ENOENT)) | ||
realpath_error(settings->stderr_filename); | ||
#endif /* __GLIBC__ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It took me a while to understand what this code is doing. I suggest moving it away in a function
int paths_same_file(const char * path1, const char * path2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
An alternate approach that doesn't userealpath
:
- open both stdout_filename and stderr_filename
fstat
the two resulting file descriptors- if they have identical
st_dev
andst_ino
, close the second fd and make it equal to the first fd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Xavier Leroy (2016/07/12 00:43 -0700):
An alternate approach that doesn't use
realpath
:
- open both stdout_filename and stderr_filename
fstat
the two resulting file descriptors- if they have identical
st_dev
andst_ino
, close the second fd- and make it equal to the first fd
Thanks a lot for this suggestion! It looks much simpler than the current
implementation and thus rather appealing.
Just a question before implementing this:
Isn't there going to be a loss in portability?
I have no idea how the st_ino is defined on a non-FAT filesystem...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thest_dev
check garantees you are comparing inodes on the same filesystem. The inode is unique within a filesystem, any filesystem. It's how the VFS (virtual file system) interface in any unix like system works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Goswin von Brederlow (2016/07/12 02:51 -0700):
The
st_dev
check garantees you are comparing inodes on the same
filesystem. The inode is unique within a filesystem, any filesystem.
It's how the VFS (virtual file system) interface in any unix like
system works.
I meant: how does all this work on Windows, on a FAT or NTFS filesystem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Under Windows, with the Win32 API, you would use GetFileInformationByHandle instead of fstat. (Note that run.c needs two completely different implementations anyway, one for Unix and the other for Win32.)
Under Cygwin, I hope the fstat emulation is good enough to produce pseudo st_ino numbers that are unique within a file system. (To be checked.)
Under Linux, if you mount a FAT or NTFS file system, I'm not sure st_ino numbers are meaningful, but do we really care for this use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Indeed - you cannot rely on st_dev and st_ino on the Microsoft implementation of stat. Alternatively, on Windows, you could use my reimplementation of C stat (seeotherlibs/win32unix/stat.c
) which does (well, certainlyshould) give meaningful st_ino and st_dev numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
David Allsopp (2016/07/13 09:47 -0700):
Indeed - you cannot rely on st_dev and st_ino on the Microsoft
implementation of stat. Alternatively, on Windows, you could use my
reimplementation of C stat (seeotherlibs/win32unix/stat.c
) which
does (well, certainlyshould) give meaningful st_ino and st_dev
numbers.
So am I correct that the current implementation is actually more
portable?
Wouldn't it be better, then, to keep it, it its own function as
@xavierleroy suggested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Xavier Leroy (2016/07/12 00:39 -0700):
stdout_realpath = realpath(settings->stdout_filename, NULL);
if (stdout_realpath == NULL)
realpath_error(settings->stdout_filename);
stderr_realpath = realpath(settings->stderr_filename, NULL);
if ( (stderr_realpath == NULL) && (errno != ENOENT) )
{
free(stdout_realpath);
realpath_error(settings->stderr_filename);
+#else}
char stdout_realpath[PATH_MAX], stderr_realpath[PATH_MAX];
if (realpath(settings->stdout_filename, stdout_realpath) == NULL)
realpath_error(settings->stdout_filename);
if ((realpath(settings->stderr_filename, stderr_realpath) == NULL) && (errno != ENOENT))
+#endif /*GLIBC */realpath_error(settings->stderr_filename);
It took me a while to understand what this code is doing. I suggest moving it away in a function
int paths_same_file(const char * path1, const char * path2)
Thanks. This has finally been done.
It turned out that the settings also needed to be propagated.
Why is this written in C when we have a perfectly fine functional language with yacc and lex to use? |
Goswin von Brederlow (2016/07/12 01:24 -0700):
There is only the part that runs programs that has been written in C. It |
I understand the desire to reduce the "trust base", but well, Unix has been tested for years and if some bad regression is introduced, it is likely to break tests, not make them succeed silently, so I don't see it as a real issue to rely on Unix in the testsuite. In a sense, the new code in the testsuite (C or not) will not be more tested than Unix, so there is no reason to expect it to be more trustworthy than Unix. Making the testsuite more portable and easier to build seems more important at this stage. |
Alain Frisch (2016/07/12 01:37 -0700):
I definitely agree with this. And while I was writing this code it felt But would it really be possible / simpler to achieve what run is |
I did not check, but I do not see upfront why a "testsuite driver" would depend on features not available in Unix (and even in the subset available under Windows). Basically, you need to launch processes and monitor (with Unix.select) their stderr/stdout and get their exit code; anything else? |
I disagree that the Unix interface is well tested, esp. its Win32 implementation. (While working on PR#650 I noticed a number of places where the behavior is not obvious to me and I don't know if anyone exercised them ever.) Plus, the "launch external process with a timeout" primitive that ocamltest needs would be nearly impossible to implement under Win32 using only what is available in the OCaml Unix interface. So, I think this primitive must be implemented in C anyway. |
Can you elaborate? |
@alainfrisch: What is needed here is roughly At any rate, I think this question "in which language is the process launcher implemented" is inessential. I'm more concerned about what needs to be done to support the full variety of tests that we have today or will need shortly. |
I think this kind of primitive should still be used from OCaml, possibly after being added to |
Branch rebased on latest trunk (1ae28b9).ocamltest extended to support expect tests.expect tests migrated.There is just one test that has a strange behaviour:testsuite/tests/typing-modules/printing.mlGiving it to expect_test displays this line:module M : sig module N : sig ... end end(the line appears both with and without -principal)The test passes, in the sense that printing.ml.corrected.corrected isidentical to printing.ml, but I'm wondering whether it is expected thatthis line is displayed.Any hint@diml perhaps? |
ghost commentedJul 12, 2016
|
Under unix a simple fix would be to keep a pipe to the process open and select on it. When the process dies the pipe gets closed and select returns. But windows has no pipes, right? |
Thanks alot@diml for your prompt and helpful response! |
@mvrn: Windows very much has pipes! But passing the handles to the child processes is much clunkier than on Unix. It would probably be easier to co-opt selecting on one of the standard handles instead, if that can be made to work? |
@shindere: it's the AppVeyor CI log from the "All checks have passed" section. The initial fix is probably simple - it's just that |
This commit ensures ocamltest.byte and ocamltest.opt get built along withthe other tools.
This commit enhances the test harness so that it becomes able torun ocamltest-based tests besides to the legacy tests it already runs.This is achieved as follows:Modification of targets in testsuite/Makefile:- make legacy runs the legacy tests- make new runs the ocamltest-based tests This uses ocamltest.opt if present and falls back to ocamltest (bytecode version) otherwise.- make all runs both the legacy tests and the ocamltest-based tests- make clean also removes the _ocamltest directories created by ocamltest to store test outputsTo know which tests to run, the testsuite/tests directory tree isexplored recursively as follows. For each of its subdirectory d:- If d contains a Makefile, then d is assumed to contain legacy tests- If d contains an ocamltests file, then d is assumed to contain ocamltest-based tests whose names are listed in the ocamltests file, one per line.- If none of these files is found, then the subdirectories of d are explored recursively.Thanks to David Allsopp for having provided a patch to let ocamltestbe run when flexlink is being bootstrapped.
A few tests rely on a Testing module located in testsuite/lib.The legacy testing infrastructure links it into the programs thatuse it as a module, but in the context of ocamltest it seems betterto provide testing as a library.This commit thus modifies the build system of the testsuite toalso build testing as a library, both in bytecode and native formats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LVGTM thanks!
Currently, the AppVeyor CI machine seems broken (see for examplethe fma build), and I have the impression that this is ocamltest-related:
Is this a known issue? |
Will submit a PR as soon as it is ready. |
Hi,Gabriel Scherer (2017/09/19 12:40 +0000): Currently, the AppVeyor CI machine seems broken (see for example [the fma build](https://ci.appveyor.com/project/avsm/ocaml/build/1.0.4243)), and I have the impression that this is ocamltest-related: ``` make[3]: Entering directory '/cygdrive/c/projects/ocaml/ocamltest' cl -nologo -O2 -Gy- -MD -WX -D_CRT_SECURE_NO_DEPRECATE -DCAML_NAME_SPACE -DUNICODE -D_UNICODE -DWINDOWS_UNICODE=1 -I../byterun -DCAML_INTERNALS -c run_win32.c run_win32.c run_win32.c(61): error C2220: warning treated as error - no 'object' file generated run_win32.c(61): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' run_win32.c(64): warning C4133: 'function': incompatible types - from 'char *' to 'LPWSTR' run_win32.c(66): warning C4133: 'function': incompatible types - from 'char **' to 'LPWSTR *' run_win32.c(88): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' run_win32.c(91): warning C4133: 'function': incompatible types - from 'char *' to 'LPWSTR' run_win32.c(93): warning C4133: 'function': incompatible types - from 'char **' to 'LPWSTR *' run_win32.c(53): warning C4133: 'initializing': incompatible types - from 'char [5]' to 'LPCTSTR' run_win32.c(140): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' run_win32.c(157): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' run_win32.c(250): warning C4133: 'function': incompatible types - from 'char *' to 'LPCWSTR' run_win32.c(251): warning C4133: 'function': incompatible types - from 'char *' to 'LPWSTR' make[3]: *** [Makefile:151: run_win32.obj] Error 2 make[3]: Leaving directory '/cygdrive/c/projects/ocaml/ocamltest' ``` Just to make sure. Does this problem still exist?Thanks,Sébastien. |
The problem doesn't show up anymore in the AppVeyor logs,and I believe that it was fixed by nojb's#1357 (Fix ocamltest / Windows /Unicode issue) …On Fri, Sep 29, 2017 at 11:15 AM, Sébastien Hinderer < ***@***.***> wrote: Hi, Gabriel Scherer (2017/09/19 12:40 +0000): > Currently, the AppVeyor CI machine seems broken (see for example [the fma build](https://ci.appveyor.com/project/avsm/ocaml/build/1.0.4243)), and I have the impression that this is ocamltest-related: > > ``` > make[3]: Entering directory '/cygdrive/c/projects/ocaml/ocamltest' > cl -nologo -O2 -Gy- -MD -WX -D_CRT_SECURE_NO_DEPRECATE -DCAML_NAME_SPACE -DUNICODE -D_UNICODE -DWINDOWS_UNICODE=1 -I../byterun -DCAML_INTERNALS -c run_win32.c > run_win32.c > run_win32.c(61): error C2220: warning treated as error - no 'object' file generated > run_win32.c(61): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' > run_win32.c(64): warning C4133: 'function': incompatible types - from 'char *' to 'LPWSTR' > run_win32.c(66): warning C4133: 'function': incompatible types - from 'char **' to 'LPWSTR *' > run_win32.c(88): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' > run_win32.c(91): warning C4133: 'function': incompatible types - from 'char *' to 'LPWSTR' > run_win32.c(93): warning C4133: 'function': incompatible types - from 'char **' to 'LPWSTR *' > run_win32.c(53): warning C4133: 'initializing': incompatible types - from 'char [5]' to 'LPCTSTR' > run_win32.c(140): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' > run_win32.c(157): warning C4133: 'function': incompatible types - from 'const char *' to 'LPCWSTR' > run_win32.c(250): warning C4133: 'function': incompatible types - from 'char *' to 'LPCWSTR' > run_win32.c(251): warning C4133: 'function': incompatible types - from 'char *' to 'LPWSTR' > make[3]: *** [Makefile:151: run_win32.obj] Error 2 > make[3]: Leaving directory '/cygdrive/c/projects/ocaml/ocamltest' > ``` Just to make sure. Does this problem still exist? Thanks, Sébastien. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#681 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAaA_mgpyr8TH07tW0-XFbRTyXOvhxt0ks5snLUtgaJpZM4JJbFr> . |
Okay thanks |
@shindere seems This is reproducible on both my RedHat Linux machine with GNU Make 4.2.1 and my 10.12 OS X machine with GNU Make 3.8.1. Seems the fix should be installedhere My attempted fix only works on my OS X machine and does not work on Linux. I don't know why and my Makefile writing skill is bad. I would appreciate if you can look into it. |
|
ce76e02 flambda-backend: Bugfix for type_application (ocaml#746)44f3afb flambda-backend: PR580 for main branch (ocaml#743)b851eaa flambda-backend: Backport first part of ocaml/ocaml PR10498 (ocaml#737)fafb4bd flambda-backend: Fix return mode for eta-expanded function in type_argument (ocaml#735)c31f6c3 flambda-backend: Fix treatment of functions called [@nontail] (ocaml#725)847781e flambda-backend: Fix build_upstream post-PR703 (ocaml#712)bfcbbf8 flambda-backend: Extend Pblock value kind to handle variants (ocaml#703)b2cab95 flambda-backend: Merge ocaml-jsta6d6e0e flambda-backend: Merge ocaml-jst88a4f63 flambda-backend: Use Pmakearray for immutable arrays (ocaml#699)eeaa44b flambda-backend: Install an ocamldoc binary (ocaml#695)48d322b flambda-backend: Ensure that GC is not invoked from bounds check failures (ocaml#681)4370fa1 flambda-backend: Review changes of term directory (ocaml#602)65a4566 flambda-backend: Add code coverage using bisect_ppx (ocaml#352)63ab65f flambda-backend: Bugfix for primitive inclusion (ocaml#662)7e3e0c8 flambda-backend: Fix inclusion checks for primitives (ocaml#661)96c68f9 flambda-backend: Speed up linking by changing cmxa format (ocaml#607)1829150 flambda-backend: Bugfix for Translmod.all_idents (ocaml#659)git-subtree-dir: ocamlgit-subtree-split:ce76e02
This PR introduces the ocamltest tool which aims at making it easier to
compile, execute and check test results of the OCaml testsuite, in order
to finally replace the makefiles that are currently in use.
A bit of documentation is available in ocamltest/README.
This branch, including the README, is very much work in progress.
Any contribution is very welcome: PRs against this branch to help migrate
tests, comments about the ocamltest tool...