eftsung / pygr

Automatically exported from code.google.com/p/pygr
0 stars 0 forks source link

Make megatests more portable #69

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Megatests in their present form aren't exactly portable, as both the 
runner script and megatests proper contain hardcoded paths. They need to 
be generalised.

Attached you will find the first batch of results on the subject.
Changes:

1. The runner script has now got paths declared as variables at the 
beginning, uses PATH rather than explicit paths to control where the 
executables are to come from, builds Pygr's PYTHONPATH automatically and 
has generally been cleaned up;

2. All hardcoded paths have been moved from megatest scripts to a config 
file, which is parsed using the ConfigParser module. An example config, 
containing paths exactly as extracted from scripts, has been provided;

3. Switching between small and full megatests can now be done by setting 
(or for the full test, unsetting) the "smallSampleKey" keywords in 
appropriate sections of the config file.

Outstanding issues:

1. Clean up send_megatest_email.py - or even better, merge it with the 
testing framework;
2. Test all the changes.

Original issue reported on code.google.com by mare...@gmail.com on 17 Feb 2009 at 8:35

Attachments:

GoogleCodeExporter commented 8 years ago
3. Generalise paths to input data as well - at present plain-text files are 
read 
from the directory the megatests run from (which doesn't work with the new 
runner 
without editing and isn't very elegant anyway) and the MySQL database name is 
hardcoded (which obviously isn't portable). Work on addressing this issue is in 
progress.

Original comment by mare...@gmail.com on 18 Feb 2009 at 1:35

GoogleCodeExporter commented 8 years ago
Attached you will find an updated version of the patch above. With the code in 
this 
form I have been able to successfully run (in quick mode, mind you) all 
megatests 
except _dm2_download_megatest.py_, which AFAIK is not run by Namshin anyway 
(why?).

Original comment by mare...@gmail.com on 21 Feb 2009 at 1:35

GoogleCodeExporter commented 8 years ago

Original comment by mare...@gmail.com on 21 Feb 2009 at 1:55

GoogleCodeExporter commented 8 years ago
Finished cleaning up send_megatest_email.py; this resulted in some more changes 
to 
run_megatests. Moreover, both scripts have been added to the repository - in a 
new 
subdirectory of tests/ called tests/tools/.

Everything (except the aforementioned dm2_download_test.py issue) seems to work 
now, 
please review. To merge all the changes I have made, use the two git-style 
patches 
from comment 2 and 4 - in other words, ignore the files attached to the 
original 
post.

Original comment by mare...@gmail.com on 3 Mar 2009 at 3:12

Attachments:

GoogleCodeExporter commented 8 years ago
We'll ask Titus to validate Marek's improvement to megatest portability, by 
making
sure that they run successfully at his site.

Original comment by cjlee...@gmail.com on 5 Mar 2009 at 12:30

GoogleCodeExporter commented 8 years ago
Reposting the first patch in the form which should apply without errors to the 
master HEAD (i.e. with megatests moved to oldtests/).

Original comment by mare...@gmail.com on 5 Mar 2009 at 10:15

Attachments:

GoogleCodeExporter commented 8 years ago
Two more patches related to test-framework changes...

1. Patch 0003: Made the runner script launch new tests instead of the old ones 
for 
the basic run, then cd to oldtests/ to run megatests;

2. Patch 0004: While testing the above I have come to the conclusion it isn't 
the 
best of ideas to have a pygrrc file in your tests directory if one wants to run 
tests on sources pulled straight from Git - the file will then override the 
user's 
home-directory pygrrc, which in this case is NOT desirable. Therefore, 
tests/pygrrc 
has been moved to pygrrc.example.

This should be it, with all four patches applied (0001n, 0002-0004) I have 
managed 
to successfully run my own megatests on leelab2 (except the download one, which 
is a 
separate issue).

Original comment by mare...@gmail.com on 6 Mar 2009 at 2:56

Attachments:

GoogleCodeExporter commented 8 years ago
Assigned to Namshin for review.

Original comment by the.good...@gmail.com on 13 Mar 2009 at 12:38

GoogleCodeExporter commented 8 years ago

Original comment by the.good...@gmail.com on 13 Mar 2009 at 12:40

GoogleCodeExporter commented 8 years ago
Namshin has updated the original send_megatest_email.py to correctly handle 
output 
from the new test framework, the attached patch ports his changes to my version.

Original comment by mare...@gmail.com on 26 Mar 2009 at 6:53

Attachments:

GoogleCodeExporter commented 8 years ago
1. ConfigParser fix: os.path.join instead of os.path.expanduser, check 
os.environ
['HOME']
2. Run time check added. Normal megatest running time (short version on 
leelab2): 11 
min, set max to 20min. You may need to change this running time according to 
your 
system performance.

Original comment by deepr...@gmail.com on 30 Mar 2009 at 2:31

Attachments:

GoogleCodeExporter commented 8 years ago
Right, since it was Namshin who posted the last patch I guess I am the reviewer 
now.

1. ConfigParser fix:
Namshin is right about using os.path.join(), os.path.expanduser() doesn't 
automatically convert path separators - which is funny, because I nicked that 
particular bit of code from official Python documentation :-) (see the code 
example 
for RawConfigParser.read() at 
http://docs.python.org/library/configparser.html). 
However:
 - as one can see at http://docs.python.org/library/os.path.html , os.path.expanduser
() is recommended for determining home-directory path because it can handle 
cases 
other than querying $HOME;
 - adding an exception handler for non-existent $HOME variable, while necessary when 
reading os.environ, is a bit redundant here because it means having two 
separate 
calls to ConfigParser.read() - which is not necessary with os.path.expanduser() 
even 
if the home directory cannot be determined for some reason (ConfigParser.read() 
quietly skips over bad paths).

Attached you will find a modified version of Namshin's patch, nominating it for 
inclusion as soon as somone (i.e. Titus or Chris, since both Namshin and I are 
now 
not objective code-wise) signs it off.

2. Running-time check
A very useful addition, except it has nothing to do with portability of 
megatests :-)
I'm about to create a new issue for it, with Namshin as owner and me as 
reviewer.

Original comment by mare...@gmail.com on 31 Mar 2009 at 4:12

Attachments:

GoogleCodeExporter commented 8 years ago
Whoops, forgot to mention what the second patch attached to the previous 
comment is. 
After my megatest patches had been merged into the master I needed to update 
the 
leelab2 test bench to keep on running correctly, at which time I found out I 
had 
forgotten to call runtest.py with '-b' - again. The patch corrects this mistake.

Original comment by mare...@gmail.com on 31 Mar 2009 at 4:15

GoogleCodeExporter commented 8 years ago
Chris had a look at the code yesterday and commited it to master. Closing the 
issue.

Original comment by mare...@gmail.com on 7 Apr 2009 at 10:54