Skip to content

Commit

Permalink
add GHA test
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Dec 27, 2021
1 parent e51963a commit 4db8615
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test cashark

on: [push, pull_request]

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup
run: |
sudo apt-get -y update
sudo apt-get -y install tshark
- name: Wireshark Version
run: tshark --version

- name: Test
run: ./test-all.sh

- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: cashark-logs
path: '**/*.out'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*~
/test/*.out
28 changes: 28 additions & 0 deletions test-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
set -e

IAM="$(readlink -f "$0")"
cd "$(dirname "$IAM")"

rm -f test/*.out

ret=0
for cap in test/*.*cap*
do
echo "======================="
echo " $cap"
echo "======================="
echo "::group::$(basename "$cap")"
if ! tshark -r "$cap" -X lua_script:ca.lua -X lua_script:pva.lua -PO ca,pva 'ca || pva' > "$cap".out
then
echo "::error file=$(basename "$cap")::exit $?"
ret=$?
elif ! [ -s "$cap".out ]
then
echo "::error file=$(basename "$cap")::Empty output"
ret=1
fi
echo "::endgroup::$(basename "$cap")"
done

exit $ret

0 comments on commit 4db8615

Please sign in to comment.