From f6e944b37d12b833c47a89b9988d9751c010af26 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 21 Dec 2019 11:40:54 +0000 Subject: [PATCH] tests/filter: New test framework for generate This test case bypasses autoconf and runs generate directly. It also gives us somewhere to write examples of each of the &-expansions without further cluttering test-example. Signed-off-by: Ian Jackson --- tests/filter/.gitignore | 2 ++ tests/filter/Subdir.mk.expected | 5 +++++ tests/filter/Subdir.sd.mk | 1 + tests/filter/check | 9 +++++++++ tests/filter/main.mk.expected | 8 ++++++++ tests/filter/update-expected | 10 ++++++++++ 6 files changed, 35 insertions(+) create mode 100644 tests/filter/.gitignore create mode 100644 tests/filter/Subdir.mk.expected create mode 100644 tests/filter/Subdir.sd.mk create mode 100755 tests/filter/check create mode 100644 tests/filter/main.mk.expected create mode 100755 tests/filter/update-expected diff --git a/tests/filter/.gitignore b/tests/filter/.gitignore new file mode 100644 index 0000000..08c232c --- /dev/null +++ b/tests/filter/.gitignore @@ -0,0 +1,2 @@ +Makefile +*.mk.tmp diff --git a/tests/filter/Subdir.mk.expected b/tests/filter/Subdir.mk.expected new file mode 100644 index 0000000..fe0e7aa --- /dev/null +++ b/tests/filter/Subdir.mk.expected @@ -0,0 +1,5 @@ +# autogenerated - do not edit +# test cases for generate script + +all:: $(TOP_TARGETS) +.PHONY: all diff --git a/tests/filter/Subdir.sd.mk b/tests/filter/Subdir.sd.mk new file mode 100644 index 0000000..f942367 --- /dev/null +++ b/tests/filter/Subdir.sd.mk @@ -0,0 +1 @@ +# test cases for generate script diff --git a/tests/filter/check b/tests/filter/check new file mode 100755 index 0000000..09b4196 --- /dev/null +++ b/tests/filter/check @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +cd tests/filter +../../generate +files=$(find -name \*.expected) +for f in $files; do diff -u $f ${f%.expected}.tmp; done + +echo ok. diff --git a/tests/filter/main.mk.expected b/tests/filter/main.mk.expected new file mode 100644 index 0000000..a5b0e9d --- /dev/null +++ b/tests/filter/main.mk.expected @@ -0,0 +1,8 @@ +# autogenerated - do not edit +top_srcdir=@top_srcdir@ +abs_top_srcdir=@abs_top_srcdir@ +SUBDIRMK_MAKEFILES := +MAKEFILE_TEMPLATES := +SUBDIRMK_MAKEFILES += Subdir.mk +MAKEFILE_TEMPLATES += ./Subdir.sd.mk +include $(SUBDIRMK_MAKEFILES) diff --git a/tests/filter/update-expected b/tests/filter/update-expected new file mode 100755 index 0000000..ff10542 --- /dev/null +++ b/tests/filter/update-expected @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Usual approach to updating the expected outputs is +# tests/filter/check +# tests/filter/update-expected +# selectively git-add the things that are right, after inspecting them + +set -e +files=$(find tests/filter -name \*.tmp) +for f in $files; do cp $f ${f%.tmp}.expected; done -- 2.30.2