selftest: Create included files during provision
authorSamuel Cabrero <scabrero@suse.de>
Fri, 31 Aug 2018 10:44:09 +0000 (12:44 +0200)
committerNoel Power <npower@samba.org>
Wed, 19 Dec 2018 11:42:09 +0000 (12:42 +0100)
Files included from smb.conf have to exists, otherwise python fails to
load the configuration. Found while trying to run a python test before
samba3.blackbox.smbd_error creates the included file.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/target/Samba3.pm

index 63c24377e96c32a72ff946e655eaeb3cb7f1597c..a86a37aa8f0de4b17e2f7f7d744846cd6872b1b4 100755 (executable)
@@ -1645,6 +1645,8 @@ sub provision($$$$$$$$$)
 
        my $conffile="$libdir/server.conf";
        my $dfqconffile="$libdir/dfq.conf";
+       my $errorinjectconf="$libdir/error_inject.conf";
+       my $delayinjectconf="$libdir/delay_inject.conf";
 
        my $nss_wrapper_pl = "$ENV{PERL} $self->{srcdir}/third_party/nss_wrapper/nss_wrapper.pl";
        my $nss_wrapper_passwd = "$privatedir/passwd";
@@ -2270,7 +2272,7 @@ sub provision($$$$$$$$$)
 [error_inject]
        copy = tmp
        vfs objects = error_inject
-       include = $libdir/error_inject.conf
+       include = $errorinjectconf
 
 [delay_inject]
        copy = tmp
@@ -2278,7 +2280,7 @@ sub provision($$$$$$$$$)
        kernel share modes = no
        kernel oplocks = no
        posix locking = no
-       include = $libdir/delay_inject.conf
+       include = $delayinjectconf
 
 [aio_delay_inject]
        copy = tmp
@@ -2302,6 +2304,18 @@ sub provision($$$$$$$$$)
            return undef;
        }
 
+       unless (open(ERRORCONF, ">$errorinjectconf")) {
+               warn("Unable to open $errorinjectconf");
+               return undef;
+       }
+       close(ERRORCONF);
+
+       unless (open(DELAYCONF, ">$delayinjectconf")) {
+               warn("Unable to open $delayinjectconf");
+               return undef;
+       }
+       close(DELAYCONF);
+
        unless (open(DFQCONF, ">$dfqconffile")) {
                warn("Unable to open $dfqconffile");
                return undef;