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

Cram tests: $TMP is not a per-test directory #1083

Closed
victorlin opened this issue Nov 1, 2022 · 2 comments
Closed

Cram tests: $TMP is not a per-test directory #1083

victorlin opened this issue Nov 1, 2022 · 2 comments

Comments

@victorlin
Copy link
Member

Filing this issue mostly to document behavior that I came across today.

Context

Unintuitively, the $TMP directory defined by Cram is the same across all tests invoked by the same cram command. This means it isn't cleaned up at the end of each test, and lingering output files from one test may affect the outcome of another test.

Instead, the starting directory of a test file is a directory under $TMP that is truly unique for that test file.

How to reproduce

See this GitHub gist.

Possible solutions

1. Clean up $TMP after every test

This is what most tests do already (e.g. tests/functional/mask.t). However, some tests still leave things under $TMP (e.g. tests/builds/zika.t leaves a directory $TMP/out/). Find these lingering files and add cleanup commands to prevent unintended side effects.

2. Run tests from the starting directory

  1. Remove pushd $TESTDIR … commands to stay in the per-test temporary directory.
  2. Change the export AUGUR commands accordingly.
  3. Replace all usage of $TMP with relative paths.
  4. Update the relative paths with $TESTDIR to use existing test files.
@corneliusroemer
Copy link
Member

Thanks for tackling this! I've noticed this in the past, too.

@victorlin
Copy link
Member Author

This has been factored into dev docs and concrete solutions proposed in #1176.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Backlog
Development

No branches or pull requests

2 participants