Skip to content

Commit

Permalink
Read out termination code and print to tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
LasseRosenow committed Jan 17, 2025
1 parent 24cb6d0 commit 3134b1b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void print_ip_addresses(void) {
}

int main() {
exit(0);
#ifdef ONLY_PRINT_IP
print_ip_addresses();
exit(0);
Expand Down
46 changes: 29 additions & 17 deletions test/platform/riot/coap_channel_federated_test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
SENDER_IP=${SENDER_IP:-fe80::44e5:1bff:fee4:dac8}
RECEIVER_IP=${RECEIVER_IP:-fe80::8cc3:33ff:febb:1b3}

# Create tap interfaces
sudo $RIOTBASE/dist/tools/tapsetup/tapsetup
# # Create tap interfaces
# sudo $RIOTBASE/dist/tools/tapsetup/tapsetup

# --------------------------- Print IP-Addresses ---------------------------
# # --------------------------- Print IP-Addresses ---------------------------

# Build sender
make ONLY_PRINT_IP=1 BOARD=native PORT=tap0 all -C ./sender
# # Build sender
# make ONLY_PRINT_IP=1 BOARD=native PORT=tap0 all -C ./sender

# Build receiver
make ONLY_PRINT_IP=1 BOARD=native PORT=tap1 all -C ./receiver
# # Build receiver
# make ONLY_PRINT_IP=1 BOARD=native PORT=tap1 all -C ./receiver

# Run sender and receiver
./sender/bin/native/*.elf tap0
./receiver/bin/native/*.elf tap1
# # Run sender and receiver
# ./sender/bin/native/*.elf tap0
# ./receiver/bin/native/*.elf tap1

# --------------------------- Build and run test ---------------------------
# # --------------------------- Build and run test ---------------------------

# Build sender
make REMOTE_ADDRESS=$RECEIVER_IP BOARD=native PORT=tap0 all -C ./sender
Expand All @@ -28,21 +28,33 @@ make REMOTE_ADDRESS=$SENDER_IP BOARD=native PORT=tap1 all -C ./receiver

SESSION_NAME="federated_coap_test"

# Create a new tmux session
tmux new-session -d -s $SESSION_NAME

# Run the sender
tmux send-keys -t $SESSION_NAME "./sender/bin/native/*.elf tap0" C-m
tmux new-session -d -s "$SESSION_NAME" "bash -c './sender/bin/native/*.elf tap0; echo \$? > /tmp/${SESSION_NAME}_sender_state'"

sleep 3

# Run the receiver
tmux split-window -h -t $SESSION_NAME
tmux send-keys -t $SESSION_NAME "./receiver/bin/native/*.elf tap1" C-m
tmux split-window -h -t $SESSION_NAME "bash -c './receiver/bin/native/*.elf tap1; echo \$? > /tmp/${SESSION_NAME}_receiver_state'"


# Attach to the tmux session
# Attach to the session for 5 seconds
{
sleep 10 && tmux detach-client -s $SESSION_NAME
} &
tmux attach-session -t $SESSION_NAME

# Check if the tmux session is still running
if tmux has-session -t $SESSION_NAME; then
tmux kill-session -t $SESSION_NAME
echo "coap_channel_federated_test did not terminate correctly"
exit 1
else
echo "Test completed: tmux session has terminated."
cat /tmp/${SESSION_NAME}_sender_state
cat /tmp/${SESSION_NAME}_receiver_state
fi

# Evaluate test output
# if [ $? -eq 0 ]; then
# echo "All tests passed."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void print_ip_addresses(void) {
}

int main() {
exit(1);
#ifdef ONLY_PRINT_IP
print_ip_addresses();
exit(0);
Expand Down

0 comments on commit 3134b1b

Please sign in to comment.