test scripts: added sum.sh
This commit is contained in:
parent
936ae389e8
commit
376b75328c
4 changed files with 53 additions and 25 deletions
|
|
@ -76,7 +76,8 @@
|
||||||
* Note CLIXON_DATADIR (=/usr/local/share/clixon) need to be in the list
|
* Note CLIXON_DATADIR (=/usr/local/share/clixon) need to be in the list
|
||||||
* CLICON_YANG_MAIN_FILE Provides a filename with a single module filename.
|
* CLICON_YANG_MAIN_FILE Provides a filename with a single module filename.
|
||||||
* CLICON_YANG_MAIN_DIR Provides a directory where all yang modules should be loaded.
|
* CLICON_YANG_MAIN_DIR Provides a directory where all yang modules should be loaded.
|
||||||
* NACM (RFC8341) experimental
|
* NACM (RFC8341)
|
||||||
|
* Experimental support, no performance enhancements and need further testing
|
||||||
* Incoming RPC Message validation is supported (3.4.4)
|
* Incoming RPC Message validation is supported (3.4.4)
|
||||||
* Data Node Access validation is supported (3.4.5), except:
|
* Data Node Access validation is supported (3.4.5), except:
|
||||||
* rule-type data-node path is not supported
|
* rule-type data-node path is not supported
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@
|
||||||
This directory contains testing code for clixon and the example
|
This directory contains testing code for clixon and the example
|
||||||
application. Assumes setup of http daemon as describe under apps/restonf
|
application. Assumes setup of http daemon as describe under apps/restonf
|
||||||
- Jenkinsfile Makefile for Jenkins tests. Build clixon and run tests.
|
- Jenkinsfile Makefile for Jenkins tests. Build clixon and run tests.
|
||||||
- all.sh Run through all tests named 'test*.sh' in this directory. Therefore, if you place a test in this directory matching 'test*.sh' it will be run automatically. By default the script will exit on first error. Run as `all.sh summary` to continue and print a summary on all tests.
|
- all.sh Run through all tests with detailed output, and stop on first error.
|
||||||
|
- sum.sh Run though all tests and print summary
|
||||||
|
- mem.sh Make valgrind
|
||||||
- site.sh Add your site-specific modifications here
|
- site.sh Add your site-specific modifications here
|
||||||
- test_nacm.sh Auth tests using internal NACM
|
- test_nacm.sh Auth tests using internal NACM
|
||||||
- test_nacm_ext.sh Auth tests using external NACM (separate file)
|
- test_nacm_ext.sh Auth tests using external NACM (separate file)
|
||||||
|
|
@ -18,14 +20,20 @@ application. Assumes setup of http daemon as describe under apps/restonf
|
||||||
- test_datastore.sh Datastore tests
|
- test_datastore.sh Datastore tests
|
||||||
- and many more...
|
- and many more...
|
||||||
|
|
||||||
Example runs:
|
Tests called 'test*.sh' and placed in this directory will be automatically run as part of the all.sh, sum.sh tests etc.
|
||||||
```
|
|
||||||
> run.sh
|
|
||||||
# Runs through all tests matching 'test_*.sh' in the directory. Prints test output
|
|
||||||
# and stops on first error
|
|
||||||
|
|
||||||
> run.sh summary
|
You can prefix a test with `BE=0` if you want to run your own backend.
|
||||||
# Same as above but continues after errors and does not print test output.
|
|
||||||
|
To run with debug flags, use the `DBG=<number>` environment variable.
|
||||||
|
|
||||||
|
You can run an individual test by itself, or run through all tests matching 'test_*.sh' in the directory. Prints test output and stops on first error:
|
||||||
|
```
|
||||||
|
all.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Run all tests but continue after errors and only print a summary test output identifying which tests succeeded and which failed:
|
||||||
|
```
|
||||||
|
all.sh summary
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
14
test/all.sh
14
test/all.sh
|
|
@ -1,14 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Run, eg as:
|
# Run, eg as:
|
||||||
# ./all.sh 2>&1 | tee test.log # break on first test
|
# ./all.sh 2>&1 | tee test.log # break on first test
|
||||||
# ./all.sh summary # to run all tests and print
|
|
||||||
|
|
||||||
summary=0
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
summary=1
|
echo "usage: $0 # detailed logs and stopon first error"
|
||||||
fi
|
|
||||||
if [ $# -gt 1 ]; then
|
|
||||||
echo "usage: $0 [summary] # pipe to dev/null and continue on error"
|
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -17,21 +12,14 @@ fi
|
||||||
err=0
|
err=0
|
||||||
for test in test*.sh; do
|
for test in test*.sh; do
|
||||||
echo "Running $test"
|
echo "Running $test"
|
||||||
if [ $summary -ne 0 ]; then
|
|
||||||
./$test > /dev/null 2>&1
|
|
||||||
errcode=$?
|
|
||||||
else
|
|
||||||
./$test
|
./$test
|
||||||
errcode=$?
|
errcode=$?
|
||||||
fi
|
|
||||||
if [ $errcode -ne 0 ]; then
|
if [ $errcode -ne 0 ]; then
|
||||||
err=1
|
err=1
|
||||||
echo -e "\e[31mError in $test errcode=$errcode"
|
echo -e "\e[31mError in $test errcode=$errcode"
|
||||||
echo -ne "\e[0m"
|
echo -ne "\e[0m"
|
||||||
if [ $summary -eq 0 ]; then
|
|
||||||
exit $errcode
|
exit $errcode
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
if [ $err -eq 0 ]; then
|
if [ $err -eq 0 ]; then
|
||||||
echo OK
|
echo OK
|
||||||
|
|
|
||||||
31
test/sum.sh
Executable file
31
test/sum.sh
Executable file
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Run, eg as:
|
||||||
|
# ./sum.sh # to run all tests and print
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
echo "usage: $0 # pipe to dev/null and continue on error"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# include err() and new() functions
|
||||||
|
. ./lib.sh
|
||||||
|
err=0
|
||||||
|
for test in test*.sh; do
|
||||||
|
echo "Running $test"
|
||||||
|
./$test > /dev/null 2>&1
|
||||||
|
errcode=$?
|
||||||
|
if [ $errcode -ne 0 ]; then
|
||||||
|
err=1
|
||||||
|
echo -e "\e[31mError in $test errcode=$errcode"
|
||||||
|
echo -ne "\e[0m"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $err -eq 0 ]; then
|
||||||
|
echo OK
|
||||||
|
else
|
||||||
|
echo -e "\e[31mError"
|
||||||
|
echo -ne "\e[0m"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue