summaryrefslogtreecommitdiff
path: root/selftest/target
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-23 23:46:02 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-24 03:19:31 +0100
commitf18d9e147d4a242cdfb31a816d91d277b99badae (patch)
treea8a129cdb56e422e0eb3d90aa5ee6783950e843a /selftest/target
parenta15aefea27fffcbf622f7032e5d50628189a49bd (diff)
downloadsamba-f18d9e147d4a242cdfb31a816d91d277b99badae.tar.gz
samba-f18d9e147d4a242cdfb31a816d91d277b99badae.tar.bz2
samba-f18d9e147d4a242cdfb31a816d91d277b99badae.zip
selftest.py: Add selftest.target.samba with bindir_path function.
Diffstat (limited to 'selftest/target')
-rw-r--r--selftest/target/samba.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/selftest/target/samba.py b/selftest/target/samba.py
new file mode 100644
index 0000000000..5e652a3528
--- /dev/null
+++ b/selftest/target/samba.py
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+# Bootstrap Samba and run a number of tests against it.
+# Copyright (C) 2005-2012 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU GPL, v3 or later.
+
+import os
+import sys
+import warnings
+
+from selftest.target import Target
+
+def bindir_path(binary_mapping, bindir, path):
+ """Find the executable to use.
+
+ :param binary_mapping: Dictionary mapping binary names
+ :param bindir: Directory with binaries
+ :param path: Name of the executable to run
+ :return: Full path to the executable to run
+ """
+ path = binary_mapping.get(path, path)
+ valpath = os.path.join(bindir, path)
+ if os.path.isfile(valpath):
+ return valpath
+ return path