1 From a85b0a942ef07b6188255b2fee2fc379e9310409 Mon Sep 17 00:00:00 2001
2 From: Noel Power <noel.power@suse.com>
3 Date: Fri, 27 Sep 2019 15:24:25 +0100
4 Subject: [PATCH] selftest: Generate a list of skip entries for SMB1
6 The following changes prepare the test system so we can generate
7 the list of tests that fail when SMB1 can no longer be negotiated
10 Change the values of 'min protocol' set for the various test
11 environments to be SMB2_02.
13 Servers will only offer protocols starting with the min specified in the
14 conf files, we don't need to change the client value here yet (until SMB1 is
18 The following environments will still negotiate SMB1
19 ad_dc_ntvfs, rpc_proxy & s4member
22 Make test won't stop on first error
24 Once this patch is applied either
25 a. Commit to gitlab or
26 b. Run a private autobuild
28 For the failing test jobs gather the stdout logs and run the parser
30 source4/scripting/devel/test_errors_regrex.py logfile
32 over the output. This script will generate lines suitable for a
35 It is a good idea as a final step to say create a file e.g.
37 selftest/skip_smb1_fails
39 and then exclude those tests, running CI with patch similar to wscript
40 below will verify that the list of tests is complete.
42 --- a/selftest/wscript
43 +++ b/selftest/wscript
44 @@ -179,6 +179,9 @@ def cmd_testonly(opt):
46 env.FILTER_OPTIONS = '${FILTER_XFAIL}'
48 + # Maybe this should be optional
49 + env.OPTIONS += ' --exclude=${srcdir}/selftest/skip_smb1_fails'
52 script/autobuild.py | 2 +-
53 selftest/target/Samba3.pm | 4 +--
54 selftest/target/Samba4.pm | 14 ++++++--
55 source4/scripting/devel/test_errors_regrex.py | 49 +++++++++++++++++++++++++++
56 4 files changed, 63 insertions(+), 6 deletions(-)
57 create mode 100755 source4/scripting/devel/test_errors_regrex.py
59 diff --git a/script/autobuild.py b/script/autobuild.py
60 index 85167cfa993..5bf087f652c 100755
61 --- a/script/autobuild.py
62 +++ b/script/autobuild.py
63 @@ -184,7 +184,7 @@ def format_option(name, value=None):
72 diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
73 index 41d439ea91a..ca14f86e0a4 100755
74 --- a/selftest/target/Samba3.pm
75 +++ b/selftest/target/Samba3.pm
76 @@ -1708,8 +1708,8 @@ sub provision($$$$$$$$$)
77 panic action = cd $self->{srcdir} && $self->{srcdir}/selftest/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
78 smbd:suicide mode = yes
80 - client min protocol = CORE
81 - server min protocol = LANMAN1
82 + client min protocol = SMB2_02
83 + server min protocol = SMB2_02
87 diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
88 index 1310e2ff09f..dd7fc807703 100755
89 --- a/selftest/target/Samba4.pm
90 +++ b/selftest/target/Samba4.pm
91 @@ -713,8 +713,8 @@ sub provision_raw_step1($$)
92 log level = $ctx->{server_loglevel}
95 - client min protocol = CORE
96 - server min protocol = LANMAN1
97 + client min protocol = SMB2_02
98 + server min protocol = SMB2_02
100 dns update command = $ctx->{samba_dnsupdate}
101 spn update command = $ctx->{python} $ENV{SRCDIR_ABS}/source4/scripting/bin/samba_spnupdate -s $ctx->{smb_conf}
102 @@ -1188,6 +1188,9 @@ rpc_server:winreg = embedded
103 rpc_server:spoolss = embedded
104 rpc_daemon:spoolssd = embedded
105 rpc_server:tcpip = no
106 + # override the new SMB2 only default
107 + client min protocol = CORE
108 + server min protocol = LANMAN1
111 $extra_smb_conf = $extra_smb_conf . $more_conf . "\n";
112 @@ -1238,7 +1241,9 @@ sub provision_rpc_proxy($$$)
113 dcerpc endpoint servers = epmapper, remote
114 dcerpc_remote:interfaces = rpcecho
115 dcerpc_remote:allow_anonymous_fallback = yes
117 + # override the new SMB2 only default
118 + client min protocol = CORE
119 + server min protocol = LANMAN1
121 path = /tmp/_ignore_cifs_to_dc_/_none_
123 @@ -1470,6 +1475,9 @@ sub provision_ad_dc_ntvfs($$$)
124 dsdb password event notification = true
125 dsdb group change notification = true
126 server schannel = auto
127 + # override the new SMB2 only default
128 + client min protocol = CORE
129 + server min protocol = LANMAN1
131 push (@{$extra_provision_options}, "--use-ntvfs");
132 my $ret = $self->provision($prefix,
133 diff --git a/source4/scripting/devel/test_errors_regrex.py b/source4/scripting/devel/test_errors_regrex.py
135 index 00000000000..eedfdbb6c35
137 +++ b/source4/scripting/devel/test_errors_regrex.py
139 +#!/usr/bin/env python3
141 +# Simple script to parse make test stdout results
142 +# to find the tests that are in error, the script
143 +# then creates a line for each error suitable for
144 +# putting into a skip file.
145 +# This scripts intended use is in SMB1 to SMB2 test
146 +# porting where it can be used to parse for failing
147 +# scripts in the case where the test envs are set
148 +# to not negotiate SMB1
154 +def parse_errors(infile):
157 + # get all test lines
159 + for line in infile:
160 + line = line.rstrip(os.linesep)
161 + if re.match("^\[.* at .*\]", line):
162 + test_info = line.split(',')
163 + if len(test_info) > 1:
164 + err = test_info[1].split()[0]
165 + if err != last_err:
166 + error_tests.append(all_tests[-1])
168 + all_tests.append(line.split(']',1)[1].lstrip())
172 + if len(sys.argv) < 2:
173 + print ("no args passed")
175 + print ("processing %s" % sys.argv[1])
176 + inputf = sys.argv[1]
177 + f = open(inputf, "r")
178 + failing_tests = parse_errors(f)
180 + for t in failing_tests:
182 + t = t.replace('(', '\\(').replace(')', '\\)')
183 + t = t.replace('[', '\\[').replace(']', '\\]')
186 +if __name__ == '__main__':