From: Ben Crocker <[email protected]>

Makefile:

Create new dist-self-test target and hook up the BATS
self tests.

1005-dist-dump-variables.bats:

In prologue, need to unset environment variables that may
have been inherited from a supra-make.

Signed-off-by: Ben Crocker <[email protected]>
---
 redhat/Makefile                                | 3 +++
 redhat/self-test/1005-dist-dump-variables.bats | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/redhat/Makefile b/redhat/Makefile
index 5ea04019d763..aa8600ae7fd4 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -392,6 +392,9 @@ dist-dump-variables:
        chmod +x $(REDHAT)/dist-dump-variables.sh
        @$(REDHAT)/dist-dump-variables.sh
 
+dist-self-test:
+       @bats $(REDHAT)/self-test/*.bats
+
 dist-help:
        @echo  'Cleaning targets:'
        @echo  '  dist-clean          - Clean redhat/configs/ and redhat/rpm/ 
directories.'
diff --git a/redhat/self-test/1005-dist-dump-variables.bats 
b/redhat/self-test/1005-dist-dump-variables.bats
index bff950e6643a..a2090b5c2194 100644
--- a/redhat/self-test/1005-dist-dump-variables.bats
+++ b/redhat/self-test/1005-dist-dump-variables.bats
@@ -4,6 +4,9 @@ function prologue()
 {
     tag=$1
     ofile=$BATS_TMPDIR/$tag.out
+    # Have to unset environment variables that may be inherited from 
supra-make:
+    grep "^[   ]*[a-zA-Z_][a-zA-Z_0-9]*[       ]*[:?]*=" 
$BATS_TEST_DIRNAME/../Makefile.common | sed -e 's/[   
]*\([a-zA-Z_][a-zA-Z_0-9]*\).*/unset \1/' | sort | uniq > 
$BATS_TMPDIR/unset-vars.sh
+    source $BATS_TMPDIR/unset-vars.sh
     GIT=$BATS_TEST_DIRNAME/egit.sh HEAD=$tag EGIT_OVERRIDE_DESCRIBE=$tag 
DIST=.fc33 make dist-dump-variables > $ofile
 }
 
-- 
GitLab
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]

Reply via email to