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

OSAL tests fails under various conditions #760

Closed
jhnphm opened this issue Jan 15, 2021 · 0 comments · Fixed by #764 or #767
Closed

OSAL tests fails under various conditions #760

jhnphm opened this issue Jan 15, 2021 · 0 comments · Fixed by #764 or #767
Labels
bug community unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Milestone

Comments

@jhnphm
Copy link

jhnphm commented Jan 15, 2021

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:

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,

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

@skliper skliper added the unit-test Tickets related to the OSAL unit testing (functional and/or coverage) label Jan 15, 2021
@skliper skliper added this to the 6.0.0 milestone Jan 15, 2021
skliper added a commit to skliper/osal that referenced this issue Jan 19, 2021
skliper added a commit to skliper/osal that referenced this issue Jan 25, 2021
astrogeco added a commit that referenced this issue Jan 25, 2021
Fix #760, Install modules and clean up files for unit tests
astrogeco added a commit to nasa/cFS that referenced this issue Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug community unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Projects
None yet
3 participants