-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add API for specifying thread stack size (#243) * Add API for specifying thread stack size * Add compile time default stack size * compile time definitions in cmake * add local variable for stack size in API * Adding temporary CMake Debug message * Removed debug message in CMakeLists.txt, added CMAKE flag to readme * Reset global variable before running new thread test * Remove duplicate code and unused variables * explicit cast * missing ) * enforce pthread min stack size * Change name of variable to have *_BYTES for readability * Update variable name to include 'bytes' by request * Addressing nit picks * bound rand stack size value to not exceed max * Remove rand() test on an OS wrapper API * Wake up github * Comment * Remove lower bound checking for pthread * Clang * StackSize and ConstrainedDevice incompatible; Additional unit tests for the thread create API; Add new CI job and script to check CMake flag compatibility * Add second case * Fix typo * Rename variables in the test * Address comments and add log line in case of conflict again --------- Co-authored-by: jdelapla <[email protected]>
- Loading branch information
1 parent
c97ddb6
commit 007f19c
Showing
7 changed files
with
288 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
# Define flag combinations as tuples with expected results | ||
# Format: "flags expected_result" | ||
# - expected_result is either OK or FAIL | ||
COMBINATIONS=( | ||
"-DKVS_DEFAULT_STACK_SIZE=65536 -DCONSTRAINED_DEVICE=ON FAIL" | ||
"-DKVS_DEFAULT_STACK_SIZE=65536 OK" | ||
"-DCONSTRAINED_DEVICE=ON OK" | ||
"-DKVS_DEFAULT_STACK_SIZE=65536 -DCONSTRAINED_DEVICE=OFF OK" | ||
"-DKVS_DEFAULT_STACK_SIZE=0 -DCONSTRAINED_DEVICE=ON OK" | ||
) | ||
|
||
# Initialize result counters | ||
TOTAL_TESTS=${#COMBINATIONS[@]} | ||
PASSED=0 | ||
FAILED=0 | ||
|
||
# Markdown summary header | ||
SUMMARY="# CMake Flag Test Summary\n" | ||
|
||
# Test each combination | ||
for combination in "${COMBINATIONS[@]}"; do | ||
# Extract flags and expected result from the tuple | ||
FLAGS="${combination% *}" # Everything except the last word | ||
EXPECTED_RESULT="${combination##* }" # The last word | ||
|
||
# Clean up the build directory before each test | ||
rm -rf build | ||
mkdir build | ||
|
||
# Run only the CMake configuration with the current combination | ||
cmake -B build $FLAGS > /dev/null 2>&1 | ||
EXIT_CODE=$? | ||
|
||
# Check if the exit code matches the expected result | ||
if [[ "$EXPECTED_RESULT" == "FAIL" ]]; then | ||
if [[ $EXIT_CODE -ne 0 ]]; then | ||
PASSED=$((PASSED + 1)) | ||
SUMMARY+="* ✅ \`$FLAGS\`: Correctly failed.\n" | ||
else | ||
FAILED=$((FAILED + 1)) | ||
SUMMARY+="* ❌ \`$FLAGS\`: Expected failure but succeeded.\n" | ||
fi | ||
else | ||
if [[ $EXIT_CODE -ne 0 ]]; then | ||
FAILED=$((FAILED + 1)) | ||
SUMMARY+="* ❌ \`$FLAGS\`: Unexpected failure.\n" | ||
else | ||
PASSED=$((PASSED + 1)) | ||
SUMMARY+="* ✅ \`$FLAGS\`: Success as expected.\n" | ||
fi | ||
fi | ||
done | ||
|
||
# Generate a Markdown summary | ||
SUMMARY+="\n### Total Tests: $TOTAL_TESTS\n" | ||
SUMMARY+="### Passed: $PASSED\n" | ||
SUMMARY+="### Failed: $FAILED\n" | ||
|
||
echo -e "$SUMMARY" | ||
|
||
if [[ $FAILED -gt 0 ]]; then | ||
exit 1 | ||
fi |
Oops, something went wrong.