summaryrefslogtreecommitdiffstats
path: root/selftest/target/Samba.pm
diff options
context:
space:
mode:
Diffstat (limited to 'selftest/target/Samba.pm')
-rw-r--r--selftest/target/Samba.pm45
1 files changed, 45 insertions, 0 deletions
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
new file mode 100644
index 00000000000..703d0b5e626
--- /dev/null
+++ b/selftest/target/Samba.pm
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+# Bootstrap Samba and run a number of tests against it.
+# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU GPL, v3 or later.
+
+package Samba;
+
+use strict;
+use target::Samba3;
+use target::Samba4;
+
+sub new($$$$$) {
+ my ($classname, $bindir, $binary_mapping, $bindir_path, $ldap, $srcdir, $exeext) = @_;
+
+ my $self = {
+ samba3 => new Samba3($bindir,$binary_mapping, $bindir_path, $srcdir, $exeext),
+ samba4 => new Samba4($bindir,$binary_mapping, $bindir_path, $ldap, $srcdir, $exeext),
+ };
+ bless $self;
+ return $self;
+}
+
+sub setup_env($$$)
+{
+ my ($self, $envname, $path) = @_;
+
+ $ENV{ENVNAME} = $envname;
+
+ my $env = $self->{samba4}->setup_env($envname, $path);
+ if (defined($env)) {
+ $env->{target} = $self->{samba4};
+ } else {
+ $env = $self->{samba3}->setup_env($envname, $path);
+ if (defined($env)) {
+ $env->{target} = $self->{samba3};
+ }
+ }
+ if (not defined $env) {
+ warn("Samba can't provide environment '$envname'");
+ return undef;
+ }
+ return $env;
+}
+
+1;