MESAHub / mesa_test

Command line tool for running the MESA test suite and uploading results to MESATestHub
MIT License
2 stars 3 forks source link

Switch checking to see if paths are directories or symlinks #20

Closed rjfarmer closed 4 years ago

rjfarmer commented 4 years ago

I'd like to be able move the test cases out of the test suite to another hard drive and put a symlink back in place (so mesa test doesn't need to understand new location) But it seem's ruby's File.directory returns false on a symlink. So this switches some of the directory checks for a directory or symlink check. Note this is my first attempt at ruby, and i don't even know how to test mesa_test itself without screwing up my installed version.

jschwab commented 4 years ago

Weird. File.directory? is documented to return true on a symlink that points to a directory. https://ruby-doc.org/core-2.5.0/File.html#method-c-directory-3F

jschwab commented 4 years ago

Also, to test, I think you can do:

rjfarmer commented 4 years ago

Serves me right for looking at an old stack overflow post for whats happening (or my complete lack of ruby knowledge making me misunderstand things)

rjfarmer commented 4 years ago

Closing for now while i dig into the actual issue (and not the one i assumed i had)

rjfarmer commented 4 years ago

Okay i understand whats going on and why what i did by mistake in the pull request works (and have tested it as well now thanks, @jschwab )

background: I need to move the test cases out of MESA_DIR onto local hard drives. I then symlink the folder back into MESA_DIR test suite so nothing needs to worry about the different locations. This means that on some nodes when mesa_test runs a test some other tests will have broken symlinks (because there not valid of that node).

When you run mesa_test it calls load_test_source_data which states "allow for brainless loading of all module data" which is perfectly reasonable thing, normally. This iterates over all test cases and sees if the folder is valid (even for test cases that you are not interested in testing because I'm using test_one). But remember the broken symlinks? load_test_source_data fails because a test case your not testing does not exist on the node your using. In a perfect world it would not care about tests its not testing.

File.directory? only succeeds if the symlink is valid so my pull request patches things so its true if the folder exists or the symlink exists (even if not valid). This skips over the issue in load_test_source_data and lets me run the test i want and not fail on tests i don't care about.

jschwab commented 4 years ago

Ah, makes sense. Nice analysis. Seems like your workaround is a reasonable short-term thing and then longer-term (git era) we should make sure test_one only cares about its test.

wmwolf commented 4 years ago

Looks reasonable. I will do another blind merge and push a new version out to rubygems.

wmwolf commented 4 years ago

0.2.14 is live on rubygems