Skip to content
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

Eliminate cp scripts in ocamltest #8659

Closed
dra27 opened this issue May 5, 2019 · 24 comments
Closed

Eliminate cp scripts in ocamltest #8659

dra27 opened this issue May 5, 2019 · 24 comments

Comments

@dra27
Copy link
Member

dra27 commented May 5, 2019

or "Allow the test directory to be set-up declaratively". Tipping context for this is #2023 (comment), where the fact on Unix ocamltest symlinks files mentioned in the files declaration but on Windows it copies them was causing tests to fail, since the intention is that the files were then modified by the tests in question (this didn't just break ocamltest hygiene, it also broke the test)

It would be nice to be able to specify files which must be copied to the test directory and in so doing eliminate mkdir and cp script actions. The other motivation is that this header:

(* TEST
files = "cant_write_to_this_file.txt"
*)

has to become the more verbose:

(* TEST
* script
script = "cp ${test_source_directory}/cant_write_to_this_file.txt can_write_to_this_file.txt"
** byte
** native
*)

My understanding is that if the byte and native actions are omitted, then the test becomes the cp and will always pass? For this case, I propose:

(* TEST
data_files = "can_write_to_this_file.txt"
*)

but a thorough solution to this issue should aim to eliminate all script actions related to setting up the test build directory.

@shindere
Copy link
Contributor

I confirm that if a test or action is mentionned, then this overrides
the tests performed by default, namely bytecode and native.

Thanks a lot for the proposal which I find indeed interesting!

@Anukriti12
Copy link
Contributor

Hi, I am an outreachy applicant. Can i work on this issue?

@shindere
Copy link
Contributor

shindere commented Mar 22, 2020 via email

@dra27
Copy link
Member Author

dra27 commented Mar 22, 2020

Given the sheer number of files in a testsuite run, I would expect that it's noticeably slower to copy (longer term, I'd hope to go the other way and have Windows do symlinking, given that most developers will be at Windows boxes which support it).

Switching between cp and ln also doesn't solve the problem for tests with more complicated set-ups like tests/regression/missing_set_of_closures/missing_set_of_closures.ml (and a lot of the Dynlink tests).

@gasche
Copy link
Member

gasche commented Mar 22, 2020

@Anukriti12 Given the uncertainty / non-consensus on how to solve the problem described in this thread, I would avoid it for now.

Others: personally I agree with the idea of having an easy way to specify files to import in the test directory. I also think that files imported there should be non-writeable by default, unless explicitly designed to be written to. I am not sure what's the best way to let test-authors express the intent that a file will be written to. (I don't understand from your proposal if data_files vs. files is supposed to express this difference; unconvinced.)

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label Mar 24, 2021
@gasche
Copy link
Member

gasche commented Mar 24, 2021

@dra27, @shindere, does any of you have opinions on how to move forward on this issue? If not, or if it's not something you want to look at in the medium term, maybe we could close?

@shindere
Copy link
Contributor

shindere commented Mar 24, 2021 via email

@dra27
Copy link
Member Author

dra27 commented Mar 24, 2021

I still think this is a good idea, but I'm not going to be working on it soon, indeed. We have an issue that the idea of longer-term "we agree this would be a good idea to do this at some point" and the "close stale issues bot"/"don't leave PRs lying around" are in conflict! The original test bitten by this issue actually needed to work around it in a different (to deal with line endings), but the principal idea of eliminating scripts (and sandboxing tests) remains useful both for testing installed compilers (which we are working on for the flambda 2 work) and cross-compilation (which we're not working on at present).

An option (which I'm personally doing with some of my "back-burner" lists privately) might be to have ROADMAP.md in addition to HACKING.md? Discussions like this could lead to an update to the ROADMAP.md file. It persists the discussion where it can be picked up in future, and it would be relatively easy to review them from time to time (either to remove items which have been done, or to remove ones which for whatever reason no longer make sense).

@gasche
Copy link
Member

gasche commented Mar 24, 2021

re. issue management: personally I think that a "suspended" tag would be fine (and we could leave the issue open in this status), if we use it with care. Sounds easier than having to decide how to structure a ROADMAP file.

Regarding the naming itself: if I understand, currently files means immutable files (that can be symlinked.) I would suggest maybe local_files or copied_files for the ones that may be modified by the test, but whose modifications should not be persisted in the testsuite source.

@shindere
Copy link
Contributor

shindere commented Mar 24, 2021 via email

@shindere
Copy link
Contributor

shindere commented Mar 24, 2021 via email

@dra27
Copy link
Member Author

dra27 commented Mar 24, 2021

@dra27: can we perhaps remian close to the topic itself and not going too high? I'm willing to implemnet the solution if we can agree on what it should be and if it's simple. Do you like the two variables approach, or not? If yes, can we agree on the names?

Ah, lovely! In which case yes, no problem. My only reason for being slightly higher level about it was if we were to further the discussion but not implement it, then we'd just have the bot trying to close the issue again in 6 months! It wasn't clear that discussing it would make progress, if you see what I mean...

I agree that renaming files to eliminate the surprise is a good idea, but I don't think it should refer to the mechanism (especially as we don't actually symlink the files on Windows at the moment).

Looking at the uses of files in the tests, could we change files to source_files or sources and use @gasche's suggestion of local_files for data? local_files could be used, say, for tests/tool-lexyacc/calc_input.txt (even though it's not actually altered).

@shindere
Copy link
Contributor

shindere commented Mar 24, 2021 via email

@dra27
Copy link
Member Author

dra27 commented Mar 24, 2021

For some reason I read the "read" in read_files in the present tense (!!) and got briefly confused. Which is embarrassing when I'm in my first language and you're in your second, but there we are!

Perhaps readonly_files (which clearly states the possibility in the future of enforcing it either by file permissions or sandbox) and modifiable_files (I definitely prefer modified to written)?

@shindere
Copy link
Contributor

shindere commented Mar 24, 2021 via email

@dra27
Copy link
Member Author

dra27 commented Mar 24, 2021

@shindere - there's no branch for this, it's just an issue

@shindere
Copy link
Contributor

shindere commented Mar 24, 2021 via email

@github-actions github-actions bot removed the Stale label Mar 26, 2021
@shindere
Copy link
Contributor

shindere commented Mar 30, 2021 via email

@shindere
Copy link
Contributor

shindere commented Mar 30, 2021 via email

@dra27
Copy link
Member Author

dra27 commented Apr 1, 2021

I agree, @shindere - directories definitely don't want to be symlinked, but "copied" (in the readonly case, the files could of course themselves be symlinked).

@shindere
Copy link
Contributor

shindere commented Apr 1, 2021 via email

@shindere
Copy link
Contributor

shindere commented Apr 8, 2021 via email

@shindere
Copy link
Contributor

As stated in
#10327 (comment), it is my
belief that PR #10327 fully addresses this issue, which I am thus closing.

Anybody should however feel free to re-open it if they think it's not
completely fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants