-
Couldn't load subscription status.
- Fork 3.4k
Parallel other tests #6150
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
Parallel other tests #6150
Conversation
6fcbab2 to
91f5200
Compare
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.
Overall I like the result here, but I'm a little confused on how this changes the status of the temp dirs, what the meaning of the canonical one is, and where that is set.
| environment: | ||
| - TEST_TARGET=other.test_n* other.test_o* other.test_p* other.test_q* other.test_r* other.test_s* other.test_t* other.test_u* other.test_v* other.test_w* other.test_x* other.test_y* other.test_z* skip:other.test_native_link_error_message | ||
| # TODO: remove skips after fastcomp update on travis for 1.37.23 | ||
| - TEST_TARGET=other skip:other.test_bad_triple skip:other.test_native_link_error_message skip:other.test_emcc_v skip:other.test_failing_alloc |
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 is emcc_v skipped?
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 has been skipped since its birth because it tends to fail whenever an SDK version update happens: #5883
| os.makedirs(temp_root) | ||
| temp_dir = tempfile.mkdtemp(dir=temp_root) | ||
| temp_root = shared.TEMP_DIR | ||
| if not os.path.exists(temp_root): |
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.
creating shared.TEMP_DIR could be done in shared, I think? seems cleaner that way, unless I'm missing something, and we don't want shared to always create it?
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.
Some tools including test runners, emar, emconfigure, etc. also imports shared, we probably don't want to create and remove empty directory for those tools.
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.
Good point, yes.
|
|
||
| def clean_emcc_files_in_temp_dir(self): | ||
| for x in os.listdir(CANONICAL_TEMP_DIR): | ||
| for x in os.listdir(self.canonical_temp_dir): |
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.
self.canonical_temp_dir is defined as a function in runner.py, but used as a string here?
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.
Ah, the class clean_write_access_to_canonical_temp_dir has its own string field canonical_temp_dir.
tests/test_other.py
Outdated
|
|
||
| def test_emcc_debug_files(self): | ||
| if os.environ.get('EMCC_DEBUG'): return self.skip('cannot run in debug mode') | ||
| canonical_temp_dir = self.canonical_temp_dir() |
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.
this seems confusing. do we need a function there, can't it always be a string?
but a larger question, why is the test runner in charge of declaring the canonical temp dir? shouldn't shared.py do that?
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.
Hmm, it can be a string. I'll fix it.
This PR dynamically assigns temporary directory path for each test runner thread so that each thread won't get any conflict when writing files in its canonical temp directory. This is not needed for normal emcc use, and shared.py is not related to parallel tests, so this is done in test runners.
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.
I see. I'm not sure, but I think we can get that benefit (each test is independent) by cleaning up the shared.py temp dir code, and using EMCC_TEMP_DIR or one of those. That seems better as the cleanup would be good by itself, and we wouldn't need any new code in the test harness for it.
As I said I'm not sure it can work, and it's a different approach than this PR, so I'd understand if you're not interested to investigate it, I could do that.
tests/runner.py
Outdated
| return ('-O2' in self.emcc_args or '-O3' in self.emcc_args or '-Oz' in self.emcc_args) and not (Settings.SIDE_MODULE or Settings.BINARYEN) | ||
|
|
||
| def canonical_temp_dir(self): | ||
| return os.path.join(self.temp_dir, 'emscripten_temp') |
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.
we still have logic in shared.py that uses that string "emscripten_temp", can we share that code so it's not duplicated?
|
Ok, this looks good to me. I think we could probably simplify the test code some more (but I'm not sure - I might look into it if I have time), but my bigger concerns before were with the non-test code, and all that looks great. |
|
@saschanaz Very strange, when I run Bisection lead me to here, but it's odd we didn't notice this breakage before. Any ideas? |
It should be fine for all parallel tests to using the same TEMP_DIR. The only limitation is on tests that use the canonical test directory (e.g. EMCC_DEBUG). It looks like we used to use a unique temp directory per process (See emscripten-core#6150). However that we changes to one-directory-per-test in emscripten-core#18214, although I don't remember why. With this change we don't create a new temp directory except for tests that are marked as `uses_canonical_tmp`
It should be fine for all parallel tests to using the same TEMP_DIR. The only limitation is on tests that use the canonical test directory (e.g. EMCC_DEBUG). It looks like we used to use a unique temp directory per process (See emscripten-core#6150). However that we changes to one-directory-per-test in emscripten-core#18214, although I don't remember why. With this change we don't create a new temp directory except for tests that are marked as `uses_canonical_tmp`
Fixes #5817, fixes #6130
Tried implementing what @juj suggested:
Edit:
othernow only takes 16 minutes on CircleCI (while ~40 minutes on Travis)!