From f2cece6381f1b1080f69d0af488b65a820d307f1 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 12 Aug 2023 11:22:54 +0100 Subject: [PATCH] Rewrite orphan-tests.rb as a make target --- .github/workflows/build-test.yml | 2 ++ test/Makemodule.am | 12 ++++++++++++ test/regress/testlist.txt | 1 + tools/orphan-tests.rb | 20 -------------------- 4 files changed, 15 insertions(+), 20 deletions(-) delete mode 100755 tools/orphan-tests.rb diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 63de8ea65..dabfe1f95 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -53,6 +53,8 @@ jobs: make -C build bin/jitperf export ASAN_OPTIONS=detect_leaks=0 # XXX: remove this ./build/bin/jitperf -L build/lib/ test/perf/simple.vhd + - name: Check for orphan tests + run: make -C build orphan-tests - name: Coverage report run: make -C build cov-generate - name: Coveralls diff --git a/test/Makemodule.am b/test/Makemodule.am index 53bd83b87..c58dde96b 100644 --- a/test/Makemodule.am +++ b/test/Makemodule.am @@ -165,6 +165,18 @@ update-test-dist: 'test/*.gtkw' 'test/*.tcl' 'test/*.v' \ | sort | sed -e 's/^/\t/' -e '$$ ! s/$$/ \\/' ; \ ) > $(top_srcdir)/test/dist.mk + +orphan-tests: + ( \ + cd $(top_srcdir) ; \ + missing=$$(comm -23 \ + <(git ls-files -- 'test/regress/*.vhd' 'test/regress/*.v' \ + | sed 's|.*/\([[:alnum:]]*\)\..*|\1|' | sort | uniq) \ + <(cut -d' ' -f1 test/regress/testlist.txt | sort) \ + | tee /dev/stderr | wc -l) ; \ + [ "$$missing" = 0 ] || exit 1 ; \ + ) + endif .PHONY: update-test-dist diff --git a/test/regress/testlist.txt b/test/regress/testlist.txt index a9ba61398..0ba80a4c1 100644 --- a/test/regress/testlist.txt +++ b/test/regress/testlist.txt @@ -849,3 +849,4 @@ issue750 normal,2008 order3 shell driver18 normal,2008 vhpi9 normal,vhpi +issue730 normal,2008 diff --git a/tools/orphan-tests.rb b/tools/orphan-tests.rb deleted file mode 100755 index cf13b9b0e..000000000 --- a/tools/orphan-tests.rb +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby - -# -# Find any tests in test/regress that are not in testlist.txt -# - -require 'rubygems' -require 'pathname' - -ScriptDir = Pathname.new(__FILE__).realpath.dirname -TestDir = ScriptDir + "../test/regress" - -have = File.open(TestDir + "testlist.txt").each_line.collect do |l| - l.split(/ /)[0] -end - -files = Dir.glob(TestDir + "*.vhd").collect do |f| - name = File.basename(f).gsub(/\.vhd/, '') - puts "missing #{name}" unless have.any? { |s| s == name } -end