From 4ef679f19b0668a53d8de00e36b12c140509566a Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 27 Oct 2022 19:58:23 +0100 Subject: [PATCH] Add GitHub workflow to test OSVVM Co-authored-by: Adam Barnes --- .github/workflows/build-test.yml | 2 +- .github/workflows/test-osvvm.yml | 50 ++++++++++++++++++++++++++++++++ src/opt.c | 4 +++ test/test-osvvm.tcl | 17 +++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-osvvm.yml create mode 100644 test/test-osvvm.tcl diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ef343bb9..e45335ba 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -157,7 +157,7 @@ jobs: - name: 'Upload artifact' uses: actions/upload-artifact@v3 with: - name: 'MSYS2 package' + name: 'MSYS2 mingw64 package' path: contrib/msys2/${{ env.MSYS2_PKG }} vests: diff --git a/.github/workflows/test-osvvm.yml b/.github/workflows/test-osvvm.yml new file mode 100644 index 00000000..40c72361 --- /dev/null +++ b/.github/workflows/test-osvvm.yml @@ -0,0 +1,50 @@ +name: Test OSVVM + +on: workflow_dispatch + +jobs: + test-osvvm: + name: Test OSVVM + runs-on: windows-2019 + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - uses: msys2/setup-msys2@v2 + with: + msystem: mingw64 + update: true + install: >- + base-devel + git + unzip + mingw-w64-x86_64-tcllib + - name: Download MSYS2 mingw64 package + id: download-artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: build-test.yml + workflow_conclusion: success + branch: master + name: MSYS2 mingw64 package + skip_unpack: false + if_no_artifact_found: fail + - name: Install NVC + run: | + pacman -U --noconfirm *.zst + - name: Test OSVVM + run: | + : # remove VHDL lib source from NVC repo (issue #557} + rm -rf lib/* + : # install OSVVM, run test, diff results with verified results + mkdir tmp && cd tmp + tclsh ../test/test-osvvm.tcl + failures=$(xmllint --xpath 'string(/testsuites/@failures)' OsvvmLibraries_RunAllTests.xml) + failuresVti=$(xmllint --xpath 'string(/testsuites/@failures)' OsvvmLibraries_RunAllTestsVti.xml) + if [ "$failures" != "0" ] || [ "$failuresVti" != "0" ]; then + echo "*** one or more tests failed ***" + exit 1 + fi diff --git a/src/opt.c b/src/opt.c index 145c9407..ed14898e 100644 --- a/src/opt.c +++ b/src/opt.c @@ -47,6 +47,10 @@ static void opt_set_generic(opt_name_t name, option_kind_t kind, assert(name < OPT_LAST_NAME); option_t *o = &(options[name]); + + if (o->kind == OPT_KIND_STRING) + free(o->value.s); + o->value = value; o->kind = kind; } diff --git a/test/test-osvvm.tcl b/test/test-osvvm.tcl new file mode 100644 index 00000000..90690e23 --- /dev/null +++ b/test/test-osvvm.tcl @@ -0,0 +1,17 @@ +# Clones OsvvmLibraries, runs all tests. Used by the test-osvvm.yml workflow. +# To run manually: +# tclsh test-osvvm.tcl +# Note: tcllib is required for OSVVM + +# known good snapshot +set OsvvmLibraries_tag "2022.09" +set OsvvmScripts_tag "e425576fbc481bd6528d3e7bfea3e2bf5800e199"; # added NVC + +exec git clone --branch $OsvvmLibraries_tag --recurse-submodules -j8 https://github.com/OSVVM/OsvvmLibraries.git >@ stdout 2>@ stdout +cd OsvvmLibraries/Scripts +exec git checkout $OsvvmScripts_tag >@ stdout 2>@ stdout +cd ../.. +source OsvvmLibraries/Scripts/StartNVC.tcl +build OsvvmLibraries/OsvvmLibraries +build OsvvmLibraries/RunAllTests +build OsvvmLibraries/RunAllTestsVti -- 2.39.2