-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
faa13d2
commit 9f263a9
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# Set the path to the test directory | ||
TEST_DIR="./bs/inst/tinytest" | ||
|
||
# Check if the directory exists | ||
if [ ! -d "$TEST_DIR" ]; then | ||
echo "Error: Directory $TEST_DIR does not exist." | ||
exit 1 | ||
fi | ||
|
||
# Run all R test files in the directory | ||
echo "Running tests in $TEST_DIR..." | ||
|
||
# Create a temporary log file | ||
LOG_FILE=$(mktemp) | ||
|
||
# Iterate over all R scripts in the test directory | ||
for TEST_FILE in "$TEST_DIR"/*.R; do | ||
echo "Running: $TEST_FILE" | ||
|
||
# Execute the test file and append the output to the log | ||
Rscript "$TEST_FILE" >>"$LOG_FILE" 2>&1 | ||
done | ||
|
||
# Check the log for FAILED tests | ||
if grep -q "FAILED" "$LOG_FILE"; then | ||
echo "Some tests FAILED. See details below:" | ||
grep "FAILED" "$LOG_FILE" | ||
else | ||
echo "All tests passed successfully!" | ||
fi | ||
|
||
# Remove the temporary log file | ||
rm "$LOG_FILE" |