1. Testing algorithm

I just ran a test on the svn Euphoria 4.0 directory with 'make -f makefile.wat testwin' and had I forgot to set EUCOMPILEDIR or EUDIR before I did. The resulting emake.bat script put the -I setting to my 3.1 EUDIR instead. Needless to say, emake.bat failed on all of them. I know that is okay and I am sure there will be someone telling me its my fault inspite of the fact what I am saying here is only background information for the problem that I found.

When the test completes, it reports success for everything except t_text.e. Even though the exe files were not created at all. I would expect it to report 100% failure.

In eutest.ex the process is created with:

status = system_exec("emake.bat", 2) 

This goes against the warnings in the documentation to use system_exec with batch files. So, I modified this to use cmd.exe /c ahead of emake.bat. CMD.exe is not a batch file so we can run system_exec on it. It is certainly better than doing what is done here but it doesn't solve the issue. I get the same results when my build process patch is applied.

What if I check if exe exists aftewards?

system("emake.bat", 2) 
status = not file_exists( filename & ".exe" )  

The problem is, this creates a race-condition problem. If emake.bat succeeds the file system might not have the existence of the resulting executable updated yet. So, instead of getting false successes you'll get false failures. Pick your posion. Is there a way to tell the OS hang this process until all current file-system changes are syncronized? Two answers are the UNIX utility sync() and the system Internals Windows utility Sync() . There ought to be a system call for this. If there isn't we need a different work around.

Shawn Pringle

new topic     » topic index » view message » categorize

2. Re: Testing algorithm

SDPringle said...

The problem is, this creates a race-condition problem. If emake.bat succeeds the file system might not have the existence of the resulting executable updated yet. So, instead of getting false successes you'll get false failures. Pick your posion. Is there a way to tell the OS hang this process until all current file-system changes are syncronized? Two answers are the UNIX utility sync() and the system Internals Windows utility Sync() . There ought to be a system call for this. If there isn't we need a different work around.

It seems like the easier thing to do would be to read in the emake script and use system_exec a line at a time, and test the exit value from the compiler.

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: Testing algorithm

The problem with running system_exec one line at a time is that the batch file is not only a set of commands. It also has flow control statements and labels.

The best I can do is test for any such *.err file, test for the exe file. If neither exist for five seconds time-out and then you have your failure based on the existence of the exe file. The lesser of evils you might say.

Shawn

new topic     » goto parent     » topic index » view message » categorize

4. Re: Testing algorithm

SDPringle said...

The problem with running system_exec one line at a time is that the batch file is not only a set of commands. It also has flow control statements and labels.

Sure, but they're just there for crude error checking. We can just ignore them (and echo commands, too). It's a known format, which we control, so it shouldn't be difficult to do.

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu