Skip to content

tests: Allow running tests from /tmp directory - #791

Open
maruixin-kls wants to merge 3 commits into
containers:mainfrom
maruixin-kls:fix-tmp-test-781
Open

maruixin-kls wants to merge 3 commits into
containers:mainfrom
maruixin-kls:fix-tmp-test-781

Conversation

@maruixin-kls

Copy link
Copy Markdown

This PR fixes issue #781.

Previously, the test helper script (tests/test-utils.sh) restricted the source directory to specific paths (like /home or /usr), causing tests to fail when the source tree was located in /tmp.

This change updates the path validation logic to explicitly allow /tmp, enabling developers to run the test suite from temporary directories.

Fixes: #781

@smcv smcv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not a solution. As the doc-comment of BwrapSandbox says, several test-cases assume that /tmp is an empty tmpfs under our control, and therefore that they can safely create predictable, hard-coded paths like /tmp/f in that tmpfs. That won't be true if /tmp is a copy of the "real" /tmp.

Perhaps you could change the BASE_BWRAP_ARGS to put a tmpfs on /dev/shm , then change all the hard-coded uses of /tmp in test-helper.py to be /dev/shm? And then it would be possible to remove the --tmpfs /tmp.

Alternatively, you could do your build in /var/tmp or some other filesystem.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test suite does not seem to work properly when compiling inside /tmp

2 participants