summaryrefslogtreecommitdiff
path: root/source4/selftest
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-02-03 15:14:31 +1100
committerAndrew Tridgell <tridge@samba.org>2011-02-07 13:22:00 +1100
commit6484da4859fe9b00a7129d89e185bb7947621243 (patch)
treee62e382fb2288d1dd3e0c352c94a215a2cdefc45 /source4/selftest
parente7b2e06130fd74a539c58a48c870c9fa1961f699 (diff)
downloadsamba-6484da4859fe9b00a7129d89e185bb7947621243.tar.gz
samba-6484da4859fe9b00a7129d89e185bb7947621243.tar.bz2
samba-6484da4859fe9b00a7129d89e185bb7947621243.zip
s4-test: allow make test to work from top level directory
this fixes the path assumptions in Samba4 make test to allow it to work from the top level directory. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/selftest')
-rwxr-xr-xsource4/selftest/tests.py12
-rw-r--r--source4/selftest/wscript27
2 files changed, 24 insertions, 15 deletions
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 6e2ade145e..047d75a8b0 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -65,7 +65,10 @@ def plantestsuite(name, env, cmdline, allow_empty_output=False):
filter_subunit_args.append("--fail-on-empty")
if "$LISTOPT" in cmdline:
filter_subunit_args.append("$LISTOPT")
- print "%s 2>&1 | ../selftest/filter-subunit %s --prefix=\"%s.\"" % (cmdline, " ".join(filter_subunit_args), name)
+ print "%s 2>&1 | %s/selftest/filter-subunit %s --prefix=\"%s.\"" % (cmdline,
+ srcdir,
+ " ".join(filter_subunit_args),
+ name)
if allow_empty_output:
print "WARNING: allowing empty subunit output from %s" % name
@@ -75,7 +78,7 @@ def add_prefix(prefix, support_list=False):
listopt = "$LISTOPT "
else:
listopt = ""
- return "../selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\"" % (listopt, prefix)
+ return "%s/selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\"" % (srcdir, listopt, prefix)
def plantestsuite_loadlist(name, env, cmdline):
@@ -136,7 +139,8 @@ def plansmbtorturetestsuite(name, env, options):
plantestsuite_loadlist(modname, env, cmdline)
-samba4srcdir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
+srcdir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../.."))
+samba4srcdir = os.path.join(srcdir, 'source4')
builddir = os.getenv("BUILDDIR", samba4srcdir)
samba4bindir = os.path.normpath(os.path.join(builddir, "bin"))
smb4torture = binpath("smbtorture")
@@ -163,7 +167,7 @@ else:
subprocess.call([smb4torture, "-V"])
-bbdir = "../testprogs/blackbox"
+bbdir = os.path.join(srcdir, "testprogs/blackbox")
configuration = "--configfile=$SMB_CONF_PATH"
diff --git a/source4/selftest/wscript b/source4/selftest/wscript
index 7020779baf..a348345dfd 100644
--- a/source4/selftest/wscript
+++ b/source4/selftest/wscript
@@ -85,8 +85,8 @@ def cmd_testonly(opt):
env.TESTS = Options.options.TESTS
- env.SUBUNIT_FORMATTER = '${PYTHON} -u ../selftest/format-subunit --prefix=${SELFTEST_PREFIX} --immediate'
- env.FILTER_XFAIL = '${PYTHON} -u ../selftest/filter-subunit --expected-failures=./selftest/knownfail'
+ env.SUBUNIT_FORMATTER = '${PYTHON} -u ${srcdir}/selftest/format-subunit --prefix=${SELFTEST_PREFIX} --immediate'
+ env.FILTER_XFAIL = '${PYTHON} -u ${srcdir}/selftest/filter-subunit --expected-failures=${srcdir}/source4/selftest/knownfail'
if Options.options.FAIL_IMMEDIATELY:
env.FILTER_XFAIL += ' --fail-immediately'
@@ -103,9 +103,9 @@ def cmd_testonly(opt):
env.OPTIONS = ''
if not Options.options.SLOWTEST:
- env.OPTIONS += ' --exclude=./selftest/slow'
+ env.OPTIONS += ' --exclude=${srcdir}/source4/selftest/slow'
if Options.options.QUICKTEST:
- env.OPTIONS += ' --quick --include=./selftest/quick'
+ env.OPTIONS += ' --quick --include=${srcdir}/source4/selftest/quick'
if Options.options.LOAD_LIST:
env.OPTIONS += ' --load-list=%s' % Options.options.LOAD_LIST
if Options.options.TESTENV:
@@ -129,13 +129,13 @@ def cmd_testonly(opt):
server_wrapper=''
if Options.options.VALGRIND_SERVER:
- server_wrapper = '../selftest/valgrind_run _DUMMY=X'
+ server_wrapper = '${srcdir}/selftest/valgrind_run _DUMMY=X'
elif Options.options.GDBTEST:
- server_wrapper = '../selftest/gdb_run _DUMMY=X'
+ server_wrapper = '${srcdir}/selftest/gdb_run _DUMMY=X'
if Options.options.SCREEN:
- server_wrapper = '%s/../selftest/in_screen %s' % (os.getcwd(), server_wrapper)
- os.environ['TERMINAL'] = '%s/../selftest/in_screen' % os.getcwd()
+ server_wrapper = '${srcdir}selftest/in_screen %s' % server_wrapper
+ os.environ['TERMINAL'] = '${srcdir}/selftest/in_screen'
elif server_wrapper != '':
server_wrapper = 'xterm -n server -l -e %s' % server_wrapper
@@ -152,7 +152,12 @@ def cmd_testonly(opt):
os.environ['LDB_MODULES_PATH'] = 'bin/modules/ldb'
# tell build system where to find config.h
- os.environ['CONFIG_H'] = 'bin/default/source4/include/config.h'
+ config_paths = [ 'bin/default/source4/include/config.h',
+ 'bin/default/include/config.h' ]
+ for p in config_paths:
+ if os.path.exists(p):
+ os.environ['CONFIG_H'] = p
+ break
st_done = os.path.join(env.SELFTEST_PREFIX, 'st_done')
if os.path.exists(st_done):
@@ -162,11 +167,11 @@ def cmd_testonly(opt):
os.makedirs(env.SELFTEST_PREFIX, int('755', 8))
# We use the full path rather than relative path because it cause problems on some plateforms (ie. solaris 8).
- cmd = '(${PERL} %s/../selftest/selftest.pl --prefix=${SELFTEST_PREFIX} --builddir=. --srcdir=. --exclude=./selftest/skip --testlist="${PYTHON} ./selftest/tests.py|" ${OPTIONS} --socket-wrapper ${TESTS} && touch ${SELFTEST_PREFIX}/st_done) | ${FILTER_OPTIONS} | tee ${SELFTEST_PREFIX}/subunit' % (os.getcwd())
+ cmd = '(${PERL} ${srcdir}/selftest/selftest.pl --prefix=${SELFTEST_PREFIX} --builddir=. --srcdir=${srcdir} --exclude=${srcdir}/source4/selftest/skip --testlist="${PYTHON} ${srcdir}/source4/selftest/tests.py|" ${OPTIONS} --socket-wrapper ${TESTS} && touch ${SELFTEST_PREFIX}/st_done) | ${FILTER_OPTIONS} | tee ${SELFTEST_PREFIX}/subunit'
if os.environ.get('RUN_FROM_BUILD_FARM') is None and not Options.options.FILTERED_SUBUNIT:
cmd += ' | ${FORMAT_TEST_OUTPUT}'
else:
- cmd += ' | ${PYTHON} -u ../selftest/filter-subunit'
+ cmd += ' | ${PYTHON} -u ${srcdir}/selftest/filter-subunit'
cmd = EXPAND_VARIABLES(opt, cmd)
print("test: running %s" % cmd)