[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Fri Dec 24 10:18:01 MST 2010
The branch, master has been updated
via b83672b tdb:tdbtorture: use TEST_DATA_PREFIX for files
via d81ceeb tdb:tdbtest: use TEST_DATA_PREFIX for files
via 7694256 testprogs:test_kinit: create tmp files under $PREFIX
via f34e797 s4:ldb:python/api: use only one ldb file in test_contains()
via 628c66a s4:ldb:python/api: use filename() instead of hardcoded filenames
from ebb4af9 Start on alpha 15.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b83672b36c1ea8c35833c40c3919b63809f16624
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Dec 24 11:54:51 2010 +0100
tdb:tdbtorture: use TEST_DATA_PREFIX for files
metze
Autobuild-User: Stefan Metzmacher <metze at samba.org>
Autobuild-Date: Fri Dec 24 18:17:53 CET 2010 on sn-devel-104
commit d81ceeb9833ec80d7ab21b34e4b3af3d79aeb845
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Dec 24 11:54:03 2010 +0100
tdb:tdbtest: use TEST_DATA_PREFIX for files
metze
commit 769425662e51e561f2a8f20f3ae264ba38467817
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Dec 24 11:41:10 2010 +0100
testprogs:test_kinit: create tmp files under $PREFIX
metze
commit f34e7978c2324df6d0bd325696acf4c30822a0c8
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Dec 24 11:40:02 2010 +0100
s4:ldb:python/api: use only one ldb file in test_contains()
metze
commit 628c66a15c22da48bb05c3208bfd146da16338d8
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Dec 24 11:11:45 2010 +0100
s4:ldb:python/api: use filename() instead of hardcoded filenames
This makes sure we use files under $SELFTEST_PREFIX instead of
the source directory.
metze
-----------------------------------------------------------------------
Summary of changes:
lib/tdb/tools/tdbtest.c | 31 ++++++++++++++++++++++--
lib/tdb/tools/tdbtorture.c | 38 +++++++++++++++++++++++------
source4/lib/ldb/tests/python/api.py | 18 ++++++++------
testprogs/blackbox/test_kinit.sh | 44 +++++++++++++++++-----------------
4 files changed, 90 insertions(+), 41 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/tdb/tools/tdbtest.c b/lib/tdb/tools/tdbtest.c
index 416bc50..44c78ef 100644
--- a/lib/tdb/tools/tdbtest.c
+++ b/lib/tdb/tools/tdbtest.c
@@ -215,16 +215,38 @@ static void merge_test(void)
tdb_delete(db, key);
}
+static char *test_path(const char *filename)
+{
+ const char *prefix = getenv("TEST_DATA_PREFIX");
+
+ if (prefix) {
+ char *path = NULL;
+ int ret;
+
+ ret = asprintf(&path, "%s/%s", prefix, filename);
+ if (ret == -1) {
+ return NULL;
+ }
+ return path;
+ }
+
+ return strdup(filename);
+}
+
int main(int argc, const char *argv[])
{
int i, seed=0;
int loops = 10000;
int num_entries;
- char test_gdbm[] = "test.gdbm";
+ char test_gdbm[1] = "test.gdbm";
+ char *test_tdb;
- unlink("test.gdbm");
+ test_gdbm[0] = test_path("test.gdbm");
+ test_tdb = test_path("test.tdb");
- db = tdb_open("test.tdb", 0, TDB_CLEAR_IF_FIRST,
+ unlink(test_gdbm[0]);
+
+ db = tdb_open(test_tdb, 0, TDB_CLEAR_IF_FIRST,
O_RDWR | O_CREAT | O_TRUNC, 0600);
gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST,
0600, NULL);
@@ -261,5 +283,8 @@ static void merge_test(void)
tdb_close(db);
gdbm_close(gdbm);
+ free(test_gdbm[0]);
+ free(test_tdb);
+
return 0;
}
diff --git a/lib/tdb/tools/tdbtorture.c b/lib/tdb/tools/tdbtorture.c
index 79fe3cd..64c5043 100644
--- a/lib/tdb/tools/tdbtorture.c
+++ b/lib/tdb/tools/tdbtorture.c
@@ -228,9 +228,9 @@ static void send_count_and_suicide(int sig)
kill(getpid(), SIGUSR2);
}
-static int run_child(int i, int seed, unsigned num_loops, unsigned start)
+static int run_child(const char *filename, int i, int seed, unsigned num_loops, unsigned start)
{
- db = tdb_open_ex("torture.tdb", hash_size, TDB_DEFAULT,
+ db = tdb_open_ex(filename, hash_size, TDB_DEFAULT,
O_RDWR | O_CREAT, 0600, &log_ctx, NULL);
if (!db) {
fatal("db open failed");
@@ -270,6 +270,24 @@ static int run_child(int i, int seed, unsigned num_loops, unsigned start)
return (error_count < 100 ? error_count : 100);
}
+static char *test_path(const char *filename)
+{
+ const char *prefix = getenv("TEST_DATA_PREFIX");
+
+ if (prefix) {
+ char *path = NULL;
+ int ret;
+
+ ret = asprintf(&path, "%s/%s", prefix, filename);
+ if (ret == -1) {
+ return NULL;
+ }
+ return path;
+ }
+
+ return strdup(filename);
+}
+
int main(int argc, char * const *argv)
{
int i, seed = -1;
@@ -280,6 +298,7 @@ int main(int argc, char * const *argv)
pid_t *pids;
int kill_random = 0;
int *done;
+ char *test_tdb;
log_ctx.log_fn = tdb_log;
@@ -308,7 +327,9 @@ int main(int argc, char * const *argv)
}
}
- unlink("torture.tdb");
+ test_tdb = test_path("torture.tdb");
+
+ unlink(test_tdb);
if (seed == -1) {
seed = (getpid() + time(NULL)) & 0x7FFFFFFF;
@@ -316,7 +337,7 @@ int main(int argc, char * const *argv)
if (num_procs == 1 && !kill_random) {
/* Don't fork for this case, makes debugging easier. */
- error_count = run_child(0, seed, num_loops, 0);
+ error_count = run_child(test_tdb, 0, seed, num_loops, 0);
goto done;
}
@@ -336,7 +357,7 @@ int main(int argc, char * const *argv)
printf("Testing with %d processes, %d loops, %d hash_size, seed=%d%s\n",
num_procs, num_loops, hash_size, seed, always_transaction ? " (all within transactions)" : "");
}
- exit(run_child(i, seed, num_loops, 0));
+ exit(run_child(test_tdb, i, seed, num_loops, 0));
}
}
@@ -389,8 +410,8 @@ int main(int argc, char * const *argv)
}
pids[j] = fork();
if (pids[j] == 0)
- exit(run_child(j, seed, num_loops,
- done[j]));
+ exit(run_child(test_tdb, j, seed,
+ num_loops, done[j]));
printf("Restarting child %i for %u-%u\n",
j, done[j], num_loops);
continue;
@@ -414,7 +435,7 @@ int main(int argc, char * const *argv)
done:
if (error_count == 0) {
- db = tdb_open_ex("torture.tdb", hash_size, TDB_DEFAULT,
+ db = tdb_open_ex(test_tdb, hash_size, TDB_DEFAULT,
O_RDWR, 0, &log_ctx, NULL);
if (!db) {
fatal("db open failed");
@@ -427,5 +448,6 @@ done:
printf("OK\n");
}
+ free(test_tdb);
return error_count;
}
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index 74de707..17c3172 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -60,7 +60,7 @@ class SimpleLdb(unittest.TestCase):
self.assertEquals([], x.modules())
def test_modules_tdb(self):
- x = ldb.Ldb("bar.ldb")
+ x = ldb.Ldb(filename())
self.assertEquals("[<ldb module 'tdb'>]", repr(x.modules()))
def test_search(self):
@@ -80,7 +80,7 @@ class SimpleLdb(unittest.TestCase):
self.assertEquals(len(l.search("", ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0)
def test_search_attr_string(self):
- l = ldb.Ldb("foo.tdb")
+ l = ldb.Ldb(filename())
self.assertRaises(TypeError, l.search, attrs="dc")
def test_opaque(self):
@@ -108,9 +108,10 @@ class SimpleLdb(unittest.TestCase):
l.delete(m.dn)
def test_contains(self):
- l = ldb.Ldb(filename())
+ name = filename()
+ l = ldb.Ldb(name)
self.assertFalse(ldb.Dn(l, "dc=foo3") in l)
- l = ldb.Ldb(filename())
+ l = ldb.Ldb(name)
m = ldb.Message()
m.dn = ldb.Dn(l, "dc=foo3")
m["b"] = ["a"]
@@ -626,13 +627,14 @@ class ModuleTests(unittest.TestCase):
def search(self, *args, **kwargs):
return self.next.search(*args, **kwargs)
+ name = filename()
ldb.register_module(ExampleModule)
- if os.path.exists("usemodule.ldb"):
- os.unlink("usemodule.ldb")
- l = ldb.Ldb("usemodule.ldb")
+ if os.path.exists(name):
+ os.unlink(name)
+ l = ldb.Ldb(name)
l.add({"dn": "@MODULES", "@LIST": "bla"})
self.assertEquals([], ops)
- l = ldb.Ldb("usemodule.ldb")
+ l = ldb.Ldb(name)
self.assertEquals(["init"], ops)
diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh
index b3b6eb3..baabbb0 100755
--- a/testprogs/blackbox/test_kinit.sh
+++ b/testprogs/blackbox/test_kinit.sh
@@ -59,11 +59,11 @@ export KRB5CCNAME
testit "reset password policies beside of minimum password age of 0 days" $VALGRIND $samba_tool pwsettings $PWSETCONFIG set --complexity=default --history-length=default --min-pwd-length=default --min-pwd-age=0 --max-pwd-age=default || failed=`expr $failed + 1`
-echo $PASSWORD > ./tmppassfile
+echo $PASSWORD > $PREFIX/tmppassfile
#testit "kinit with keytab" $samba4kinit $enctype --keytab=$PREFIX/dc/private/secrets.keytab $SERVER\$@$REALM || failed=`expr $failed + 1`
-testit "kinit with password" $samba4kinit $enctype --password-file=./tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1`
-testit "kinit with password (enterprise style)" $samba4kinit $enctype --enterprise --password-file=./tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1`
-testit "kinit with password (windows style)" $samba4kinit $enctype --renewable --windows --password-file=./tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1`
+testit "kinit with password" $samba4kinit $enctype --password-file=$PREFIX/tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1`
+testit "kinit with password (enterprise style)" $samba4kinit $enctype --enterprise --password-file=$PREFIX/tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1`
+testit "kinit with password (windows style)" $samba4kinit $enctype --renewable --windows --password-file=$PREFIX/tmppassfile --request-pac $USERNAME@$REALM || failed=`expr $failed + 1`
testit "kinit renew ticket" $samba4kinit $enctype --request-pac -R
test_smbclient "Test login with kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
@@ -71,20 +71,20 @@ test_smbclient "Test login with kerberos ccache" 'ls' -k yes || failed=`expr $fa
testit "check time with kerberos ccache" $VALGRIND $samba_tool $CONFIGURATION -k yes $@ time $SERVER || failed=`expr $failed + 1`
USERPASS=testPass at 12%
-echo $USERPASS > ./tmpuserpassfile
+echo $USERPASS > $PREFIX/tmpuserpassfile
testit "add user with kerberos ccache" $VALGRIND $samba_tool user add nettestuser $USERPASS $CONFIGURATION -k yes $@ || failed=`expr $failed + 1`
echo "Getting defaultNamingContext"
BASEDN=`$ldbsearch $options --basedn='' -H ldap://$SERVER -s base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}'`
-cat > ./tmpldbmodify <<EOF
+cat > $PREFIX/tmpldbmodify <<EOF
dn: cn=nettestuser,cn=users,$BASEDN
changetype: modify
add: servicePrincipalName
servicePrincipalName: host/nettestuser
EOF
-testit "modify servicePrincipalName" $VALGRIND $ldbmodify -H ldap://$SERVER ./tmpldbmodify -k yes $@ || failed=`expr $failed + 1`
+testit "modify servicePrincipalName" $VALGRIND $ldbmodify -H ldap://$SERVER $PREFIX/tmpldbmodify -k yes $@ || failed=`expr $failed + 1`
testit "set user password with kerberos ccache" $VALGRIND $samba_tool password set $DOMAIN\\nettestuser $USERPASS $CONFIGURATION -k yes $@ || failed=`expr $failed + 1`
@@ -93,24 +93,24 @@ testit "enable user with kerberos cache" $VALGRIND $enableaccount nettestuser -H
KRB5CCNAME="$PREFIX/tmpuserccache"
export KRB5CCNAME
-testit "kinit with user password" $samba4kinit $enctype --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
+testit "kinit with user password" $samba4kinit $enctype --password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
NEWUSERPASS=testPaSS at 34%
testit "change user password with 'samba-tool password change' (rpc)" $VALGRIND $samba_tool password change -W$DOMAIN -U$DOMAIN\\nettestuser%$USERPASS $CONFIGURATION -k no $NEWUSERPASS $@ || failed=`expr $failed + 1`
-echo $NEWUSERPASS > ./tmpuserpassfile
-testit "kinit with user password" $samba4kinit $enctype --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
+echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
+testit "kinit with user password" $samba4kinit $enctype --password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
USERPASS=$NEWUSERPASS
NEWUSERPASS=testPaSS at 56%
-echo $NEWUSERPASS > ./tmpuserpassfile
+echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
-cat > ./tmpkpasswdscript <<EOF
+cat > $PREFIX/tmpkpasswdscript <<EOF
expect Password
password ${USERPASS}\n
expect New password
@@ -120,16 +120,16 @@ send ${NEWUSERPASS}\n
expect Success
EOF
-testit "change user password with kpasswd" $rkpty ./tmpkpasswdscript $samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1`
+testit "change user password with kpasswd" $rkpty $PREFIX/tmpkpasswdscript $samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1`
-testit "kinit with user password" $samba4kinit $enctype --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
+testit "kinit with user password" $samba4kinit $enctype --password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
NEWUSERPASS=testPaSS at 78%
-echo $NEWUSERPASS > ./tmpuserpassfile
+echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
-cat > ./tmpkpasswdscript <<EOF
+cat > $PREFIX/tmpkpasswdscript <<EOF
expect New password
send ${NEWUSERPASS}\n
expect Verify password
@@ -137,16 +137,16 @@ send ${NEWUSERPASS}\n
expect Success
EOF
-testit "set user password with kpasswd" $rkpty ./tmpkpasswdscript $samba4kpasswd --cache=$PREFIX/tmpccache nettestuser@$REALM || failed=`expr $failed + 1`
+testit "set user password with kpasswd" $rkpty $PREFIX/tmpkpasswdscript $samba4kpasswd --cache=$PREFIX/tmpccache nettestuser@$REALM || failed=`expr $failed + 1`
-testit "kinit with user password" $samba4kinit $enctype --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
+testit "kinit with user password" $samba4kinit $enctype --password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
NEWUSERPASS=testPaSS at 910%
-echo $NEWUSERPASS > ./tmpuserpassfile
+echo $NEWUSERPASS > $PREFIX/tmpuserpassfile
-cat > ./tmpkpasswdscript <<EOF
+cat > $PREFIX/tmpkpasswdscript <<EOF
expect New password
send ${NEWUSERPASS}\n
expect Verify password
@@ -154,9 +154,9 @@ send ${NEWUSERPASS}\n
expect Success
EOF
-testit "set user password with kpasswd and servicePrincipalName" $rkpty ./tmpkpasswdscript $samba4kpasswd --cache=$PREFIX/tmpccache host/nettestuser@$REALM || failed=`expr $failed + 1`
+testit "set user password with kpasswd and servicePrincipalName" $rkpty $PREFIX/tmpkpasswdscript $samba4kpasswd --cache=$PREFIX/tmpccache host/nettestuser@$REALM || failed=`expr $failed + 1`
-testit "kinit with user password" $samba4kinit $enctype --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
+testit "kinit with user password" $samba4kinit $enctype --password-file=$PREFIX/tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1`
test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
--
Samba Shared Repository
More information about the samba-cvs
mailing list