Skip to content

Commit

Permalink
GitHub Actions: testing against ns-3.35, ns-3.40, ns-3.41
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelegiona committed Jun 17, 2024
1 parent bc8f45c commit 3dda2cd
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ns-3.35.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
push:
branches:
- 'tests'

jobs:
ns3_check:
runs-on: ubuntu-latest
name: Compatibility ns-3.35 (Ubuntu 18.04)
steps:
- name: ns3-compatibility-action
uses: emanuelegiona/ns3-compatibility-action@v1.0.0
with:
ns3_docker_img: egiona/ns3-base:u18.04-n3.35
test_script: run-tests.sh
15 changes: 15 additions & 0 deletions .github/workflows/ns-3.40.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
push:
branches:
- 'tests'

jobs:
ns3_check:
runs-on: ubuntu-latest
name: Compatibility ns-3.40 (Ubuntu 20.04)
steps:
- name: ns3-compatibility-action
uses: emanuelegiona/ns3-compatibility-action@v1.0.0
with:
ns3_docker_img: egiona/ns3-base:u20.04-n3.40
test_script: run-tests.sh
15 changes: 15 additions & 0 deletions .github/workflows/ns-3.41.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
push:
branches:
- 'tests'

jobs:
ns3_check:
runs-on: ubuntu-latest
name: Compatibility ns-3.41 (Ubuntu 22.04)
steps:
- name: ns3-compatibility-action
uses: emanuelegiona/ns3-compatibility-action@v1.0.0
with:
ns3_docker_img: egiona/ns3-base:u22.04-n3.41
test_script: run-tests.sh
41 changes: 41 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Prepare output files
OUTCOME=1
echo "${OUTCOME}" > /home/exit-code.txt
echo "ext-process: Test not run" > /home/test-output.txt

# Install module into ns-3 "contrib" tree using the Makefile (assumption: working directory is the same as this file)
OUTCOME=1
cp -r ext-process /home/
cd /home

# Update path to external process's launcher file in test file
sed -i 's%^\( std::string launcherPath = \).*$%\1'"\"${NS3_DEBUG_DIR}/contrib/ext-process/launcher-py.sh\";"'%' /home/ext-process/test/ext-process-test-suite.cc

# Ensure debug profile _before_ copying module
export NS3_CURR_PROFILE=${NS3_DEBUG_DIR}
make sync_module FILE=ext-process

# Necessary to avoid killing docker parent processes (build scripts send USR1 signal in interactive shells)
trap "echo Ignoring USR1" USR1
./build-debug.sh && OUTCOME=0

if [[ "$OUTCOME" -eq 1 ]]; then
echo "Error: build failed"
else
# Run module-specific tests and retain their outputs
OUTCOME=1
make test SUITE=ext-process LOG=/home/test-output && \
OUTCOME=0

if [[ "$OUTCOME" -eq 1 ]]; then
echo "Error: tests failed"
fi
fi

# Only return success if all previous commands executed correctly
echo "${OUTCOME}" > /home/exit-code.txt

# === No exit here ===
# Avoids exiting the entrypoint sub-script from GitHub action that sources this file

0 comments on commit 3dda2cd

Please sign in to comment.