[PATCH] Add substitutions %t, %j, and %J as path-safe variants of %T, %i, and %I.

Dr. Thomas Orgis thomas.orgis at uni-hamburg.de
Mon Nov 27 14:34:48 UTC 2017

Am Fri, 24 Nov 2017 09:43:15 +1300
schrieb Andrew Bartlett via samba-technical <samba-technical at lists.samba.org>:

> This is an interesting addition.  Could you add some tests for it?

I'm trying. I started by adding

 	ok &= subst_test("%j %J", "", "", -1, -1, "0_0_0_0 0_0_0_0");

to run_local_substitute. A test for the %t substitution is more tricky
as the test for the existing %T is missing. Need to insert a fake time,
too. I guess fixing that would be the task of a patch before my patch …

Actually, I also was unable to find a reference to %T, %i or %I in the
selftest/target/Samba3.pm definitions. I would happily have added
entries for my path-safe variants, but my cargo cult approach does not
work when I do not have the fruits prepared for picking. I need to
guess a lot to get the tests right, although it should be fairly simple
for someone used to the test suite.

I am adding tests now for my variants of the substitutions that also
had tests before, and am omitting tests for the variants of
substitutions that also had no test before … this seems about fair;-)

Another patch should introduce tests for %T and %t, IMHO. An updated
version of the patch is attached. The little test I added seems to pass:

shell$ make test TESTS=local-substitute
skipping subunit (testscenarios not available)
OPTIONS --configfile=$SMB_CONF_PATH --option='fss:sequence timeout=1' --maximum-runtime=$SELFTEST_MAXTIME --basedir=$SELFTEST_TMPDIR --format=subunit --option=torture:progress=no
[1(0)/1 at 0s] samba3.smbtorture_s3.LOCAL-SUBSTITUTE

ALL OK (1 tests in 1 testsuites)

A summary with detailed information can be found in:
TOP 10 slowest tests
samba3.smbtorture_s3.LOCAL-SUBSTITUTE -> 0
'testonly' finished successfully (0.848s)



PS: My development box cannot run the tests successfully because
I do not have PAM (yes, still possible;-). I can configure samba
--without-pam, but the test suite is not prepared for that:

test: running (/usr/bin/perl /stuff/src/samba/selftest/selftest.pl --target=samba --prefix=./st --srcdir=/stuff/src/samba --exclude=/stuff/src/samba/selftest/skip --testlist="/usr/bin/python /stuff/src/samba/selftest/tests.py|" --testlist="/usr/bin/python /stuff/src/samba/source3/selftest/tests.py|" --testlist="/usr/bin/python /stuff/src/samba/source4/selftest/tests.py|"  --exclude=/stuff/src/samba/selftest/slow --nss_wrapper_so_path=/stuff/src/samba/bin/default/lib/nss_wrapper/libnss-wrapper.so --resolv_wrapper_so_path=/stuff/src/samba/bin/default/lib/resolv_wrapper/libresolv-wrapper.so --socket_wrapper_so_path=/stuff/src/samba/bin/default/lib/socket_wrapper/libsocket-wrapper.so --uid_wrapper_so_path=/stuff/src/samba/bin/default/lib/uid_wrapper/libuid-wrapper.so --use-dns-faking --socket-wrapper  && touch ./st/st_done) | /usr/bin/python -u /stuff/src/samba/selftest/filter-subunit --expected-failures=/stuff/src/samba/selftest/knownfail --expected-failures=/stuff/src/samba/selftest/knownfail.d --flapping=/stuff/src/samba/selftest/flapping --flapping=/stuff/src/samba/selftest/flapping.d | tee ./st/subunit | /usr/bin/python -u /stuff/src/samba/selftest/format-subunit --prefix=./st --immediate
DNS: Faking nameserver
Traceback (most recent call last):
  File "/stuff/src/samba/selftest/tests.py", line 43, in <module>
Error creating recipe from /usr/bin/python /stuff/src/samba/selftest/tests.py| at /stuff/src/samba/selftest/selftest.pl line 674.

ALL OK (0 tests in 0 testsuites)

A summary with detailed information can be found in:
TOP 10 slowest tests
ERROR: test command failed to complete
make: *** [Makefile:17: test] Fehler 1
16:46|host:samba$ cat st/summary 
= Skipped tests =

One might catch this at the configure stage instead.

I finally resorted to the deployment machine where there is a more
standard Linux system. The full test suite has this result:

FAILED (139 failures, 33 errors and 2 unexpected successes in 48 testsuites)

I am not sure how bad or good that is. It doesn't say how many
individual tests passed to put the 139 failures into perspective. This
is a stock Ubuntu 16.04 x86-64 system. Just the samba packages on it
are patched, obviously. The server works, so it doesn't seem to be too

Dr. Thomas Orgis
Universität Hamburg
RRZ / Basis-Infrastruktur / HPC
Schlüterstr. 70
20146 Hamburg
Tel.: 040/42838 8826
Fax: 040/428 38 6270
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-substitutions-t-j-and-J-as-path-safe-variants-of.patch
Type: text/x-patch
Size: 6923 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20171127/b8599462/0001-Add-substitutions-t-j-and-J-as-path-safe-variants-of.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4967 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20171127/b8599462/smime.bin>

More information about the samba-technical mailing list