-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Describe the bug
osal_loader_UT would fail while running on the target, since the utmod/* files aren't installed along w/ the test executable to build/exe/*
In addition, under certain circumstances, the following tests may fail, i.e. if another user has run the tests and files are left in /dev/shm (the tests don't clean up the files):
file-api-test
select-test
To Reproduce
For the first case, run test out of build/exe/[cpu]
For the second case, run file-api-test/select-test once, chown the files under /dev/shm/RAM[N] to some other user, and run again.
Expected behavior
Tests should succeed
Code snips
Should have an install line for the test modules here:
osal/src/unit-tests/osloader-test/CMakeLists.txt
Lines 18 to 20 in bfca5b2
| COMPILE_DEFINITIONS "MODULE_NAME=module${MOD}" | |
| PREFIX "" | |
| LIBRARY_OUTPUT_DIRECTORY utmod) |
Should test if actual directory is writable, not just if the parent tmp directory is writable,
osal/src/os/posix/src/os-impl-filesys.c
Lines 156 to 165 in bfca5b2
| if (tmpdir != NULL && stat(tmpdir, &stat_buf) == 0) | |
| { | |
| /* check if the user has write permission to the directory */ | |
| if ((stat_buf.st_mode & S_IWOTH) != 0 || | |
| ((stat_buf.st_mode & S_IWGRP) != 0 && stat_buf.st_gid == getegid()) || | |
| ((stat_buf.st_mode & S_IWUSR) != 0 && stat_buf.st_uid == geteuid())) | |
| { | |
| break; | |
| } | |
| } |
This alone wouldn't solve the issue though, just punt it to the next available tmp directory. You'd probably also want to use mkstemp() or similar to generate a randomly named directory under the tmp folder.
System observed on:
- Linux
Reporter Info
John N Pham, Northrop Grumman