github.com/hyperledger/aries-framework-go@v0.3.2/scripts/run_vc_test_suite.sh (about) 1 #!/bin/bash 2 # 3 # Copyright SecureKey Technologies Inc. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 set -e 8 9 echo "Running aries-framework-go Verifiable Credential test suite..." 10 11 GENERATOR_NAME=aries-framework-go-gen 12 VC_TEST_SUITE=vc-test-suite 13 REPORT_NAME=aries-framework-go 14 DIR=$(pwd) 15 GENERATOR_DIR="${DIR}/pkg/doc/verifiable/test-suite" 16 17 BUILD_DIR="${DIR}/build" 18 SUITE_DIR="${BUILD_DIR}/${VC_TEST_SUITE}/suite" 19 20 # build the app to test 21 cd $GENERATOR_DIR 22 # rename test file in order to be able to build it 23 rm -rf tmp 24 mkdir tmp 25 cp verifiable_suite_test.go tmp/vc_test_suite_app.go 26 cp -R contexts tmp/ 27 cd tmp 28 go build -tags testsuite -o "${BUILD_DIR}/${VC_TEST_SUITE}/${GENERATOR_NAME}" 29 cd .. 30 rm -rf tmp 31 cd "${BUILD_DIR}/${VC_TEST_SUITE}" 32 export PATH=$PATH:`pwd` 33 34 # get the suite 35 rm -rf ${SUITE_DIR} 36 git clone --depth=1 -q https://github.com/w3c/vc-test-suite suite 37 38 # build the suite 39 cd ${SUITE_DIR} 40 npm install 41 cp "${GENERATOR_DIR}/config.json" . 42 43 # patch JWS test input data (as long as https://github.com/w3c/vc-test-suite/issues/103 is opened) 44 cp "${GENERATOR_DIR}/vc_jwt.patch" . 45 git apply vc_jwt.patch 46 47 # run the suite 48 set +e 49 mocha --recursive --timeout 10000 test/vc-data-model-1.0/ -R json > "implementations/${REPORT_NAME}-report.json" 50 51 sed '/\"tests\": \[/,$d' < "implementations/${REPORT_NAME}-report.json" > ${BUILD_DIR}/${VC_TEST_SUITE}/summary.json 52 echo "}" >> ${BUILD_DIR}/${VC_TEST_SUITE}/summary.json 53 54 echo "Test suite summary:" 55 cat ${BUILD_DIR}/${VC_TEST_SUITE}/summary.json 56 echo "See full test suite results at ${SUITE_DIR}/implementations/${REPORT_NAME}-report.json" 57 58 cd $DIR 59 60 echo 61 if grep -q "\"failures\": 0" ${BUILD_DIR}/${VC_TEST_SUITE}/summary.json; then 62 echo "Verifiable Credential test suite passed!" 63 exit 0 64 else 65 echo "Verifiable Credential test suite did not pass" 66 exit 1 67 fi