-
Notifications
You must be signed in to change notification settings - Fork 39
155 lines (130 loc) · 4.6 KB
/
tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Tests
# new draft: https://godbolt.org/z/qMa4YG
on:
pull_request:
branches: [master, devel]
push:
branches: [master, devel, test-ci, webusb]
jobs:
compile:
strategy:
fail-fast: false
matrix:
target: [linux-aarch64, linux-amd64, linux-armhf, macos-x86, wasm, windows-amd64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/compile
with:
target: ${{ matrix.target }}
- name: List outputs
run: |
sudo rm -f cpp/build/*.fat
ls -la cpp/build/
ls -la test/build/
- uses: actions/upload-artifact@v2
with:
name: libfibre-${{ matrix.target }}
path: cpp/build/libfibre-*
- uses: actions/upload-artifact@v2
with:
name: test-server-${{ matrix.target }}
path: test/build/test_node.elf
test-pyfibre:
needs: [compile]
strategy:
fail-fast: false
matrix:
#os: [ubuntu-latest, macos-latest, windows-latest] # TODO: add TCP support to windows and macOS to test on CI
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R artifacts
- name: Run test server
run: |
uname -a
ARCH="$(uname -m)"
if [[ "$OSTYPE" == "msys" ]] && [[ "$ARCH" == "x86_64" ]]; then
ARCH="windows-amd64"
elif [[ "$OSTYPE" == "linux-gnu"* ]] && [[ "$ARCH" == "x86_64" ]]; then
ARCH="linux-amd64"
elif [[ "$OSTYPE" == "darwin"* ]] && [[ "$ARCH" == "x86_64" ]]; then
ARCH="macos-x86"
brew install coreutils # needed for the timeout command to work
else
echo "Unknown platform: $OSTYPE-$ARCH"
false
fi
python3 --version
chmod +x ./artifacts/test-server-$ARCH/test_node.elf
ls ./artifacts/test-server-$ARCH/test_node.elf
cp ./artifacts/libfibre-$ARCH/* ./python/fibre/
# Launch test server in background
LD_PRELOAD=libSegFault.so FIBRE_LOG=5 ./artifacts/test-server-$ARCH/test_node.elf --server --domain tcp-server:address=localhost,port=14220 >test_server.log 2>&1 &
# TODO: try launching client/server in reverse order
sleep 1
if FIBRE_LOG=5 timeout --signal=9 5s python3 ./test/test_client.py; then
echo "Test client succeeded"
CLIENT_STATUS="ok"
elif [ "$?" == "124" ]; then
echo "Test client timed out"
CLIENT_STATUS="timeout"
else
echo "Test client failed"
CLIENT_STATUS="fail"
fi
# Tell test_node.elf politely to finish (if it's still running)
echo "terminiating test server"
# TODO: find out why SIGINT doesn't work
kill -9 $! || true
SERVER_STATUS="ok"
#timeout 1s kill -2 $! || true
#echo "kill command completed"
## If it failed to react, force kill
#sleep 1
#echo "checking if still running"
#if kill -0 $!; then
# echo "Test server did not react to SIGINT. Killing."
# kill -9 $! || true
# SERVER_STATUS="timeout"
#elif ! wait $!; then
# echo "Test server returned error code"
# SERVER_STATUS="fail"
#else
# SERVER_STATUS="ok"
#fi
echo "Test server log:"
cat test_server.log
[ $CLIENT_STATUS == "ok" ] && [ $SERVER_STATUS == "ok" ]
shell: bash
formatting:
strategy:
fail-fast: false
runs-on: ubuntu-20.04 # need a recent clang-format
steps:
- uses: actions/checkout@v2
- name: Check C++ Formatting
run: |
clang-format --version
# TODO: we run this only on a few selected files for now until we have it properly configured
files="test/test_node.cpp
test/test_node.hpp
sim/sim_main.cpp"
NUM_BAD=0
while read file; do
if ! clang-format -style=file --Werror --dry-run "$file"; then
NUM_BAD=$(( $NUM_BAD + 1 ))
fi
done <<< "$files"
if ! [ "$NUM_BAD" == "0" ]; then
echo "$NUM_BAD files need formatting"
false # fail CI
else
echo "all files good"
fi
# TODO: check if interface_generator outputs the same thing with Python 3.5 and Python 3.8