From 97fcc316bce5a8f1765e01683862ae6a9ac45434 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Mon, 5 Dec 2022 19:48:08 +0100 Subject: [PATCH] test.sh tests both CDDL and no splits --- .github/workflows/test.yml | 2 +- scripts/cddl/test.sh | 21 +++++++++++++++++++++ scripts/test.sh | 17 ++--------------- 3 files changed, 24 insertions(+), 16 deletions(-) create mode 100755 scripts/cddl/test.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9c66819c..d6cf84738 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,7 @@ jobs: with: toolchain: stable - name: Validate CDDL files - run: ./scripts/test.sh + run: ./scripts/cddl/test.sh - name: Archive CDDL files uses: actions/upload-artifact@v3 with: diff --git a/scripts/cddl/test.sh b/scripts/cddl/test.sh new file mode 100755 index 000000000..e5d837291 --- /dev/null +++ b/scripts/cddl/test.sh @@ -0,0 +1,21 @@ +#! /bin/bash +set -ex + +SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P) +ROOT=$(dirname $SCRIPT_DIR) + +if ! [ -x "$(command -v cddl)" ] || [ "$1" = "--upgrade" ]; then + echo 'Installing cddl' + cargo install cddl +fi + +if [[ "$(npm list parse5)" =~ "empty" ]] || [ "$1" = "--upgrade" ]; then + echo 'Installing npm package parse5' + npm install parse5 +fi + +# Extract CDDL content from spec into files +$ROOT/scripts/cddl/generate.js + +cddl compile-cddl --cddl local.cddl +cddl compile-cddl --cddl remote.cddl diff --git a/scripts/test.sh b/scripts/test.sh index e5d837291..53c47c93d 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -4,18 +4,5 @@ set -ex SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P) ROOT=$(dirname $SCRIPT_DIR) -if ! [ -x "$(command -v cddl)" ] || [ "$1" = "--upgrade" ]; then - echo 'Installing cddl' - cargo install cddl -fi - -if [[ "$(npm list parse5)" =~ "empty" ]] || [ "$1" = "--upgrade" ]; then - echo 'Installing npm package parse5' - npm install parse5 -fi - -# Extract CDDL content from spec into files -$ROOT/scripts/cddl/generate.js - -cddl compile-cddl --cddl local.cddl -cddl compile-cddl --cddl remote.cddl +sh $ROOT/scripts/cddl/test.sh +node $ROOT/scripts/formatter/no_split_var.js