Skip to content

Commit

Permalink
Added regression test prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
iondev33 committed Sep 10, 2024
1 parent 1265b1d commit 14a2cdf
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
###########################
Expand All @@ -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
Expand Down Expand Up @@ -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





Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions build-list.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions scripts/extract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SRC=src
INC=inc
OUT_BIN=bin
MAN=man
TESTS=tests

SOURCES=(
$SOURCE_PATH/bpv7/library/ext/bpsec/bcb.c
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 14a2cdf

Please sign in to comment.