From 584f1970bd8063eff630fe640eba19ab969955dc Mon Sep 17 00:00:00 2001 From: Renato Athaydes Date: Mon, 29 Apr 2024 19:48:23 +0200 Subject: [PATCH] Added JGrab Client Shell Test. --- .github/workflows/test.yml | 7 +------ jgrab-client/test.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100755 jgrab-client/test.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad77e1c..e7c57d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,9 +26,4 @@ jobs: run: cargo build - name: Smoke Test shell: bash - run: | - export JGRAB_HOME="$(pwd)/.jgrab" - mkdir $JGRAB_HOME - cp ./jgrab-runner/build/libs/jgrab.jar $JGRAB_HOME/jgrab.jar - ls -al $JGRAB_HOME - ./jgrab-client/target/debug/jgrab-client -e "2 + 2" + run: jgrab-client/test.sh diff --git a/jgrab-client/test.sh b/jgrab-client/test.sh new file mode 100755 index 0000000..392353c --- /dev/null +++ b/jgrab-client/test.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -e + +DIR=$(dirname "$0") +export JGRAB_HOME="$DIR/.jgrab" +mkdir "$JGRAB_HOME" +cp "$DIR"/../jgrab-runner/build/libs/jgrab.jar "$JGRAB_HOME"/jgrab.jar +ls -al "$JGRAB_HOME" +jgrab="$DIR"/target/debug/jgrab-client + +# start the daemon +$jgrab -t + +result=$($jgrab -e "2 + 2") + +if test "$result" = "4" +then + echo "OK" +else + echo "Failed, result is not 4: $result" + exit 1 +fi + +# cleanup +$jgrab -s + +# on Windows, this may fail +rm -r "$JGRAB_HOME" || true