Skip to content

Commit 80b6438

Browse files
committed
New test to demonstrate non-Prune fixed branch bug
1 parent 9e88bb7 commit 80b6438

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

.github/workflows/MiniPlex.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
build/MiniPlex -T -p 20001 -r 127.0.0.1 -t 50000 &
7878
build/MiniPlex -P -p 20002 -r 127.0.0.1 -t 50000 &
7979
build/MiniPlex -P -p 20003 -r 127.0.0.1 -t 50000 -B 127.0.0.1 -b 50001 &
80+
build/MiniPlex -T -p 20004 -r 127.0.0.1 -t 50000 -B 127.0.0.1 -b 50001 &
8081
socat pty,raw,echo=0,link=SerialEndpoint1 pty,raw,echo=0,link=SerialEndpoint2 &
8182
socat pty,raw,echo=0,link=SerialEndpoint3 pty,raw,echo=0,link=SerialEndpoint4 &
8283
socat pty,raw,echo=0,link=SerialEndpoint5 pty,raw,echo=0,link=SerialEndpoint6 &
@@ -104,9 +105,14 @@ jobs:
104105
Test/PruneMode.sh 50000 127.0.0.1 20002
105106
106107
- if: ${{ always() && !contains(matrix.os,'windows') }}
107-
name: Test Permanent Branches
108+
name: Test Permanent Branches Prune
108109
run: |
109110
Test/PermanentBranches.sh 50000 50001 127.0.0.1 20003
111+
112+
- if: ${{ always() && !contains(matrix.os,'windows') }}
113+
name: Test Permanent Branches Trunk
114+
run: |
115+
Test/PermanentBranchesTrunk.sh 50000 50001 127.0.0.1 20004
110116
111117
- if: ${{ always() && !contains(matrix.os,'windows') }}
112118
name: Test ProtoConv Delim

Test/PermanentBranchesTrunk.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
#Test MiniPlex permanent branches
4+
# Same as trunk mode, except the trunk speaks first, to prove the perm branch still gets it
5+
6+
#Usage: <this_script> <MiniPlex trunk port> <MiniPlex perm port> <MiniPlex host> <MiniPlex port>
7+
8+
# Check if host and port are provided
9+
if [ $# -ne 4 ]; then
10+
echo "Error: Please provide trunk-port perm-port host and port arguments"
11+
echo "Usage: $0 <MiniPlex trunk port> <MiniPlex perm port> <MiniPlex host> <MiniPlex port>"
12+
exit 1
13+
fi
14+
15+
# Execute ncat commands and capture output
16+
exec 3< <((sleep 0.5 && echo -n 3 && sleep 2 && echo -n 3 && sleep 0.5) | ncat -u -p $1 $3 $4)
17+
sleep 0.1
18+
exec 4< <((sleep 1 && echo -n 4 && sleep 2) | ncat -u -p $2 $3 $4)
19+
sleep 0.1
20+
exec 5< <((sleep 1.5 && echo -n 5 && sleep 1.5) | ncat -u $3 $4)
21+
sleep 0.1
22+
exec 6< <((sleep 2 && echo -n 6 && sleep 1) | ncat -u $3 $4)
23+
sleep 0.1
24+
25+
# Read outputs
26+
OUT3=$(cat <&3)
27+
OUT4=$(cat <&4)
28+
OUT5=$(cat <&5)
29+
OUT6=$(cat <&6)
30+
31+
# Initialize error flag
32+
ERROR_FOUND=0
33+
34+
# Check OUT3
35+
if [ "$OUT3" != "456" ]; then
36+
echo "Error: OUT3 expected '456', got '$OUT3'"
37+
ERROR_FOUND=1
38+
fi
39+
40+
# Check OUT4
41+
if [ "$OUT4" != "33" ]; then
42+
echo "Error: OUT4 expected '33', got '$OUT4'"
43+
ERROR_FOUND=1
44+
fi
45+
46+
# Check OUT5
47+
if [ "$OUT5" != "3" ]; then
48+
echo "Error: OUT5 expected '3', got '$OUT5'"
49+
ERROR_FOUND=1
50+
fi
51+
52+
# Check OUT6
53+
if [ "$OUT6" != "3" ]; then
54+
echo "Error: OUT6 expected '3', got '$OUT6'"
55+
ERROR_FOUND=1
56+
fi
57+
58+
# Exit with appropriate status
59+
if [ $ERROR_FOUND -eq 1 ]; then
60+
exit 1
61+
else
62+
echo "All tests passed."
63+
exit 0
64+
fi

0 commit comments

Comments
 (0)