From 14a2cdf05419b89995443f7d197c09b2122d0d20 Mon Sep 17 00:00:00 2001 From: "Jay L. Gao" Date: Mon, 9 Sep 2024 17:09:25 -0700 Subject: [PATCH] Added regression test prototype --- Makefile | 28 ++++++++++++++++++++++++++++ README.md | 20 ++++++++++++++++++++ build-list.mk | 8 ++++++-- scripts/extract.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cdbd9b6..2d2671b 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,25 @@ endif $(info build-list.mk has been included, proceed to build.) +########################################### +# Build a test list based on selected CLAs +########################################### +# Initialize TEST_LIST as empty +TEST_LIST := + +# Conditionally add to TEST_LIST based on the contents of PROGRAMS +ifeq ($(filter stcpcli, $(PROGRAMS)), stcpcli) + TEST_LIST += bench-stcp +endif + +ifeq ($(filter udpcli, $(PROGRAMS)), udpcli) + TEST_LIST += bench-udp +endif + +ifeq ($(filter ltpcli, $(PROGRAMS)), ltpcli) + TEST_LIST += bench-ltp +endif + ########################### # Build Rules ########################### @@ -25,6 +44,7 @@ export INC = $(PWD)/inc export OUT_BIN = $(PWD)/bin export MAN = $(PWD)/man export SCR = $(PWD)/scripts +export TESTS = $(PWD)/tests # Just locally: MDIR = $(PWD)/mdir @@ -104,16 +124,24 @@ clean: @find $(OUT_BIN) -type f ! -name '.gitkeep' ! -name 'ionstart' ! -name 'ionstart.awk' ! -name 'ionstop' ! -name 'killm' -exec rm -f {} + > /dev/null @find $(LIB) -type f ! -name '.gitkeep' -exec rm -f {} + > /dev/null +test: + @cd $(TESTS) && ./runtests $(TEST_LIST) + uninstall: @rm -f $(INSTALL_PATH)/bin/* @rm -f $(INSTALL_PATH)/man/* +## Clean up all build artifacts + all source files extracted from ION open source code distclean: @find $(INC) -mindepth 1 ! -name '.gitkeep' -exec rm -rf {} + > /dev/null @find $(SRC) -mindepth 1 ! -name '.gitkeep' -exec rm -rf {} + > /dev/null @find $(LIB) -mindepth 1 ! -name '.gitkeep' -exec rm -rf {} + > /dev/null @find $(OUT_BIN) -mindepth 1 ! -name '.gitkeep' -exec rm -rf {} + > /dev/null @find $(MAN) -mindepth 1 ! -name '.gitkeep' -exec rm -rf {} + > /dev/null + @find $(TESTS) -mindepth 1 ! -name '.gitkeep' -exec rm -rf {} + > /dev/null + @rm system_up > /dev/null + + diff --git a/README.md b/README.md index e8ca707..315925d 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ - [Selecting ION-core Features to Build](#selecting-ion-core-features-to-build) - [Man Page Installation](#man-page-installation) - [Creating ION configuration (".rc") files for a two-node setup](#creating-ion-configuration-rc-files-for-a-two-node-setup) + - [Post installation test](#post-installation-test) + - [Clean up process](#clean-up-process) - [Automated Script to Build, Install, and Test Ion-core on Two Hosts](#automated-script-to-build-install-and-test-ion-core-on-two-hosts) - [Adjusting Pre-Allocation of Memory/Storage Space for ION](#adjusting-pre-allocation-of-memorystorage-space-for-ion) - [Tuning LTP Performance](#tuning-ltp-performance) @@ -87,6 +89,24 @@ Similar syntax goes for udp. To use other convergence layers such as UDP or STCP, you will need to modify the .rc files. See the ION documentation for more information. For example, you may consult the [ION Configuration Tutorials and Configuration Templates.](https://nasa-jpl.github.io/ION-DTN/Basic-Configuration-File-Tutorial/) +## Post installation test + +After installation, you can run the following command to test the installation for each of the CLAs included in the build: + +```bash +make test +``` + +The result of the test will be captured in a file, in the `tests` directory, under the name `progress`. Previous test results will be moved to a new file with date-time stamps. + +There are three tests currently available: `bench-ltp`, `bench-stcp`, and `bench-udp`. Each test will be invoked if the corresponding CLA is included in the build. Each test includes attempts to send different combinations of number of bundles and bundle sizes. If all transmissions are successful, the test will be marked as PASSED. If not, the test output on the console as well as the `progress` file will capture data for analysis. + +## Clean up process + +To remove executables and libraries installed in the host, run: `sudo make clean` +To clean up the compilation artifacts, run: `make clean` +To remove all complication artifacts, as well as all ION source and test files extracted from the ION open source code, run: `make distclean` + ## Automated Script to Build, Install, and Test Ion-core on Two Hosts To streamline the process, we have created two bash scripts that can automate the build, installation, and testing of ion-core. diff --git a/build-list.mk b/build-list.mk index dbfc612..e98c7e0 100644 --- a/build-list.mk +++ b/build-list.mk @@ -41,12 +41,16 @@ PROGRAMS += bpsink bpsource bpecho bping bpstats bptrace # This list can be modified. At least one CLA must be included. # ICI PROGRAMS += psmwatch sdrwatch -# BPv7 +## BPv7 PROGRAMS += bpversion +## Load-and-Go Command PROGRAMS += lgagent lgsend -# CLA: must include at least one of STCP, UDP, or LTP +# CLA: must include at least one of STCP, UDP, or LTP +## STCP CLA PROGRAMS += stcpcli stcpclo +## UDP CLA PROGRAMS += udpcli udpclo +## LTP CLA PROGRAMS += ltpcli ltpclo udplsi udplso ltpclock ltpdeliv ltpmeter ltpadmin # Utility Programs diff --git a/scripts/extract.sh b/scripts/extract.sh index a36694d..c7e60e7 100755 --- a/scripts/extract.sh +++ b/scripts/extract.sh @@ -55,6 +55,7 @@ SRC=src INC=inc OUT_BIN=bin MAN=man +TESTS=tests SOURCES=( $SOURCE_PATH/bpv7/library/ext/bpsec/bcb.c @@ -345,6 +346,19 @@ MANPAGE=( $SOURCE_PATH/bpv7/doc/pod1/stcpclo.pod ) +TEST_SCRIPTS=( + $SOURCE_PATH/tests/runtests + $SOURCE_PATH/tests/cleanup + $SOURCE_PATH/tests/setacs.sh + $SOURCE_PATH/system_up +) + +TEST_DIRS=( + $SOURCE_PATH/demos/bench-udp + $SOURCE_PATH/demos/bench-ltp + $SOURCE_PATH/demos/bench-stcp +) + # Function to clear the content of a directory clear_directory() { if [ -d "$1" ] && [ "$(ls -A "$1")" ]; then @@ -359,6 +373,7 @@ clear_directory() { clear_directory "$SRC" clear_directory "$INC" clear_directory "$OUT_BIN" +clear_directory "$TESTS" echo "Extracting source .c files from $SOURCE_PATH to $SRC" count=0 @@ -411,6 +426,33 @@ while [ "x${MANPAGE[count]}" != "x" ] count=$(( $count + 1 )) done +echo "Extracting test scripts from $SOURCE_PATH to $TESTS" +count=0 +while [ "x${TEST_SCRIPTS[count]}" != "x" ] + do + if cp "${TEST_SCRIPTS[count]}" $TESTS + then echo found "${TEST_SCRIPTS[count]}" + else echo ERROR: "${TEST_SCRIPTS[count]}" is missing or has moved. Aborting. + break + fi + count=$(( $count + 1 )) +done + +echo "Place 'system_up' script in root directory" +cp $TESTS/system_up $TESTS/.. + +echo "Extracting test sets from $SOURCE_PATH to $TESTS" +count=0 +while [ "x${TEST_DIRS[count]}" != "x" ] + do + if cp -r "${TEST_DIRS[count]}" $TESTS + then echo found "${TEST_DIRS[count]}" + else echo ERROR: "${TEST_DIRS[count]}" is missing or has moved. Aborting. + break + fi + count=$(( $count + 1 )) +done + # Replace the bpextensions.c file with the ION-core customized version. # with compiler switches cp $SCRIPT_DIR/bpextensions-ion-core.c ./$INC/bpextensions.c