From: Ralph Boehme Date: Wed, 8 Mar 2017 06:18:36 +0000 (+0100) Subject: s3/selftest: adopt config.h check from source4 X-Git-Tag: samba-4.4.11~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c0b98801bbf1a24bb90bb99b3edac1a5095002f;p=thirdparty%2Fsamba.git s3/selftest: adopt config.h check from source4 No change in behaviour. Bug: https://bugzilla.samba.org/show_bug.cgi?id=7537 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (backported from commit 6e54d8d2bda2c9232676f8c08c626f22de50f52b) --- diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index fd4f6156cd0..4ad8aa98ec4 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -36,6 +36,25 @@ def plansmbtorture4testsuite(name, env, options, description=''): selftesthelpers.plansmbtorture4testsuite( name, env, options, target='samba3', modname=modname) +# find config.h +try: + config_h = os.environ["CONFIG_H"] +except KeyError: + samba4bindir = bindir() + config_h = os.path.join(samba4bindir, "default/include/config.h") + +# check available features +config_hash = dict() +f = open(config_h, 'r') +try: + lines = f.readlines() + config_hash = dict((x[0], ' '.join(x[1:])) + for x in map(lambda line: line.strip().split(' ')[1:], + filter(lambda line: (line[0:7] == '#define') and (len(line.split(' ')) > 2), lines))) +finally: + f.close() + +have_libarchive = ("HAVE_LIBARCHIVE" in config_hash) plantestsuite("samba3.blackbox.success", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_success.sh")]) plantestsuite("samba3.blackbox.failure", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_failure.sh")]) @@ -194,19 +213,6 @@ for env in ["fileserver"]: # tar command tests # - # find config.h - try: - config_h = os.environ["CONFIG_H"] - except KeyError: - config_h = os.path.join(samba4bindir, "default/include/config.h") - - # see if libarchive is supported - f = open(config_h, 'r') - try: - have_libarchive = ("HAVE_LIBARCHIVE 1" in f.read()) - finally: - f.close() - # tar command enabled only if built with libarchive if have_libarchive: # Test smbclient/tarmode