minor unit test check script update
This commit is contained in:
9
check.sh
9
check.sh
@@ -1,11 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
red=`tput setaf 1`
|
||||
green=`tput setaf 2`
|
||||
reset=`tput sgr0`
|
||||
|
||||
FILE="$1"
|
||||
|
||||
if ([ -f "$FILE" ] && [ -s "$FILE" ]) || ([ -d "$FILE" ] && [ "$(ls -A "$FILE")" ]);
|
||||
then
|
||||
echo "[OK ] $FILE"
|
||||
echo "${green}[OK ]${reset} $FILE"
|
||||
exit 0
|
||||
else
|
||||
echo "[FAIL] $FILE" >&2
|
||||
echo "${red}[FAIL]${reset} $FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
4
tests/results/README.md
Normal file
4
tests/results/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Unit Test Results
|
||||
====
|
||||
|
||||
This directory contains the temporary and resultant output files for the docker-based unit tests. Upon the conclusion of the suite of unit tests a check will be run, and all files in this directory will be deleted. See `start.sh` for more information.
|
||||
@@ -1,11 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Runs test image and monitor image as daemons
|
||||
# Before running this script, run: make unit_tests [COMPILE_FLAGS] to build the necessary docker images
|
||||
|
||||
# Runs test sdk and monitor containers based on the images built by the makefile
|
||||
test_name="docker_demo"
|
||||
echo 'Starting containers for: ' "$test_name"
|
||||
touch "$test_name".name
|
||||
test_container=$(docker run -d -it -v $PWD/_results:/opt/results --privileged --device=/dev/net/tun "$test_name":latest)
|
||||
monitor_container=$(docker run -d -it -v $PWD/_results:/opt/results --privileged --device=/dev/net/tun "$test_name"_monitor:latest)
|
||||
test_container=$(docker run -d -it -v $PWD/tests/results:/opt/results --privileged --device=/dev/net/tun "$test_name":latest)
|
||||
monitor_container=$(docker run -d -it -v $PWD/tests/results:/opt/results --privileged --device=/dev/net/tun "$test_name"_monitor:latest)
|
||||
|
||||
sleep 90
|
||||
./check.sh _results/OK.docker_demo.txt
|
||||
|
||||
# By this stage, enough time should have passed for all of the unit tests to conclude
|
||||
RESULTS_DIR=tests/results
|
||||
|
||||
./check.sh $RESULTS_DIR/OK.docker_demo.txt
|
||||
echo $(cat $RESULTS_DIR/OK.docker_demo.txt)
|
||||
|
||||
rm -rf *.tmp
|
||||
rm -rf *.txt
|
||||
Reference in New Issue
Block a user