[PATCH] samba-tool throws error if there is an empty FSMO role

Andreas Schneider asn at samba.org
Tue May 10 13:18:07 UTC 2016


On Tuesday, May 10, 2016 11:46:04 AM Rowland Penny wrote:
> On 10/05/16 10:41, Andreas Schneider wrote:
> > On Monday, May 09, 2016 07:04:44 PM Rowland Penny wrote:
> >> On 05/05/16 18:22, Andrew Bartlett wrote:
> >>> On Thu, 2016-05-05 at 15:05 +0100, Rowland Penny wrote:
> >>>> OK, so I re-read all Andrews posts, decided to try to do what he
> >>>> said,
> >>>> set up the testenv and see what happens with the stock fsmo.py.
> >>>> He said:
> >>>> 
> >>>> If you run "SELFTEST_TESTENV=fl2000dc:local make testenv"
> >>>> 
> >>>> Then you can play in that environment.
> >>>> 
> >>>> so I tried that and it wouldn't work, but the error message told what
> >>>> was wrong, I wasn't in the root dir of the Samba tarball.
> >>>> 
> >>>> Moved there and tried again:
> >>>> SELFTEST_TESTENV=fl2000dc:local make testenv
> >>>> 
> >>>> and got this:
> >>>> 
> >>>> Waf: Leaving directory `/usr/src/samba/samba-4.4.3/bin'
> >>>> 'build' finished successfully (4m12.098s)
> >>>> ERROR: You must use --enable-selftest to enable selftest
> >>>> Makefile:27: recipe for target 'testenv' failed
> >>>> make: *** [testenv] Error 1
> >>>> 
> >>>> So from this, I think I will need to do this:
> >>>> 
> >>>> Download Samba tarball
> >>>> Unpack tarball
> >>>> cd into directory created
> >>>> run './configure --enable-selftest' along with any other configure
> >>>> options I require
> >>>> make
> >>>> SELFTEST_TESTENV=fl2000dc:local make testenv
> >>>> 
> >>>> Is this correct ??
> >>> 
> >>> Pretty much.  I would check out git master instead, as that is what you
> >>> will be patching, and run ./configure.developer rather than ./configure
> >>> --enable-selftest (due to other reported bugs I've not yet dug into,
> >>> and we don't want to get into here), but otherwise, that is correct.
> >>> 
> >>> Thanks!
> >>> 
> >>> Andrew Bartlett
> >> 
> >> OK, I have tried, but I just don't understand how the tests are supposed
> >> to work, it looks like 'selftest.pl' calls various other scripts and
> >> runs a test script that ultimately tests something (in my case,
> >> fsmo.py). writing a script to actually run 'samba-tool fsmo show' should
> >> be fairly easy, but the bits in-between are defeating me. it doesn't
> >> help that whilst looking in the various 'selftest' directories, I am
> >> finding perl, python and bash scripts. I can understand the last two,
> >> but perl, well this is a foreign language to me and I don't speak any
> >> foreign languages :-)
> >> 
> >> Is there an idiots guide to writing Samba tests ??? The idiot being me
> >> :-D
> >> 
> >> Rowland
> > 
> > I gave a talk at SambaXP about selftest last year. It has some pictures
> > which help to understand it:
> > 
> > 
> > https://sambaxp.org/archive_data/SambaXP2015-SLIDES/thu/track3/sambaxp2015
> > -thu-track3-Andreas_Schneider-HowToUseTheSambaSelftestSuite.pdf
> Thanks, I will have a look.
> 
> > Tests are run against a target. A target is e.g.: ad_dc, fl2008r2dc, ...
> > 
> > You can get a list of possible targets doing:
> > 	grep "sub setup_" selftest/target/Samba4.pm
> > 
> > A test is an executable (shell script, python script, ...) scheduled
> > against a target (fl2008r2dc e.g. is a functional level 2008r2 ad_dc).
> > 
> > You schedule a test (executable or script) against a target in
> > source4/selftest/tests.py
> > 
> > For test development it is useful to run 'make testenv' (like explained by
> > Andrew earlier). Using the testenv you can execute the test (executable or
> > script) directly in the test environment while writing it. It makes test
> > development easier.
> 
> The problem is that when you run 'make testenv', it seems to run, do
> some testing and then end, am I supposed to then start samba ???

'make testenv' should give you an xterm. The xterm is a like a shell on a 
client machine. Samba and everything else is started and set up. The xterm 
(make sure xterm is installed) will print information of the IP address, 
username and password you can use ...

If we you want we can have a phone call next week and a session where I can 
show and explain everything to you ... 



More information about the samba-technical mailing list