tests: Make "make -j distcheck" work in Python.
authorWerner Koch <wk@gnupg.org>
Tue, 20 Sep 2016 17:58:00 +0000 (19:58 +0200)
committerWerner Koch <wk@gnupg.org>
Tue, 20 Sep 2016 17:58:00 +0000 (19:58 +0200)
* lang/python/Makefile.am (SUBDIRS): Make current dir fist.
* lang/python/tests/Makefile.am (xcheck): Depend on pubring-stamp.
(CLEANFILES): Remove private-keys-v1.d/gpg-sample.stamp.
(check-local): Remove.
(initial.py): Remove dependency.
(./pubring-stamp): Depend on conf files and the
private-keys-v1.d/gpg-sample.stamp file.  Also replace use of
basename.

--

This addresses the problem that two rules might run the private keys
copy rule and due to the files being chmod -w during make discheck the
second process running that rule's cp would get a permission error.

Signed-off-by: Werner Koch <wk@gnupg.org>
lang/python/Makefile.am
lang/python/tests/Makefile.am

index da626d1..897c2a6 100644 (file)
@@ -25,7 +25,7 @@ EXTRA_DIST = \
        examples \
        pyme
 
-SUBDIRS = tests
+SUBDIRS = tests
 
 COPY_FILES = \
        $(srcdir)/gpgme.i \
index 0538e54..aa88bdc 100644 (file)
@@ -65,14 +65,16 @@ EXTRA_DIST = support.py $(XTESTS) encrypt-only.asc sign-only.asc \
 check: xcheck
 
 .PHONY: xcheck
-xcheck:
+
+xcheck: ./pubring-stamp
        $(TESTS_ENVIRONMENT) $(PYTHON) $(srcdir)/run-tests.py \
          --interpreters="$(PYTHONS)" --srcdir=$(srcdir) $(TESTFLAGS) \
          $(XTESTS)
 
 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
        gpg-agent.conf pubring.kbx~ gpg.conf pubring.gpg~ \
-       random_seed .gpg-v21-migrated pubring-stamp
+       random_seed .gpg-v21-migrated \
+        pubring-stamp private-keys-v1.d/gpg-sample.stamp
 
 private_keys = \
         $(test_srcdir)/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
@@ -85,21 +87,17 @@ clean-local:
        -$(top_srcdir)/tests/start-stop-agent --stop
        -rm -fR -- private-keys-v1.d openpgp-revocs.d S.gpg-agent sshcontrol
 
-check-local: ./gpg.conf ./gpg-agent.conf ./pubring-stamp \
-           ./private-keys-v1.d/gpg-sample.stamp
-
-# To guarantee that check-local is run before any tests we
-# add this dependency:
-initial.py: check-local
 
 ./private-keys-v1.d/gpg-sample.stamp: $(private_keys)
        test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
        for k in $(private_keys); do \
-          cp $$k private-keys-v1.d/`basename $$k`.key; \
+          cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \
         done
        echo x > ./private-keys-v1.d/gpg-sample.stamp
 
-./pubring-stamp: $(test_srcdir)/pubdemo.asc
+./pubring-stamp: $(test_srcdir)/pubdemo.asc           \
+                 ./gpg.conf ./gpg-agent.conf          \
+                 ./private-keys-v1.d/gpg-sample.stamp
        $(GPG) --batch --no-permission-warning \
                --import $(test_srcdir)/pubdemo.asc
        -$(GPG) --batch --no-permission-warning \