]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
selftest: add TESTENV_CLUSTER_LEVEL_GLOBAL_HEX_VALUE handling for testing
authorStefan Metzmacher <metze@samba.org>
Thu, 6 Aug 2026 15:38:33 +0000 (17:38 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 7 Aug 2026 16:29:25 +0000 (16:29 +0000)
In order to do manual tests we can use:
make testenv SELFTEST_TESTENV="clusteredmember:local" \
TESTENV_CLUSTER_LEVEL_GLOBAL_HEX_VALUE=...

For level 0.1 set TESTENV_CLUSTER_LEVEL_GLOBAL_HEX_VALUE to:
0x01000000010000000000000000000000000000000000000001000000

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Aug  7 16:29:25 UTC 2026 on atb-devel-224

selftest/target/Samba3.pm

index b99708df1a2688b373a2fb97d9237c2f68ff0d14..bae391b3dca5e11fc33a54f510885651cd4fc9dd 100755 (executable)
@@ -4563,6 +4563,39 @@ sub wait_for_start_ctdb($$)
 
        print "\nCTDB initialized\n";
 
+       #
+       # In order to do manual cluster level testing
+       # you can use something like this:
+       # make testenv \
+       # SELFTEST_TESTENV="clusteredmember:local" \
+       # TESTENV_CLUSTER_LEVEL_GLOBAL_HEX_VALUE=...
+       #
+       # For level 0.1 set TESTENV_CLUSTER_LEVEL_GLOBAL_HEX_VALUE to:
+       # 0x01000000010000000000000000000000000000000000000001000000
+       # See cluster_level.idl for more examples.
+       #
+       my $node0_ctdb = "ctdb/tests/local_daemons.sh ${prefix} onnode 0 ${ctdb}";
+       if (defined($ENV{TESTENV_CLUSTER_LEVEL_GLOBAL_HEX_VALUE})) {
+
+               # This is "CLUSTER_LEVEL_GLOBAL" in hex without zero termination
+               my $hexkey = "0x434c55535445525f4c4556454c5f474c4f42414c";
+               my $hexval = $ENV{TESTENV_CLUSTER_LEVEL_GLOBAL_HEX_VALUE};
+
+               my $cmd1 ="${node0_ctdb} attach cluster_level.tdb persistent";
+               my $ret1 = system($cmd1);
+               if ($ret1 != 0) {
+                       print("\"$cmd1\" failed\n");
+                       return undef;
+               }
+
+               my $cmd2 = "${node0_ctdb} pstore cluster_level.tdb ${hexkey} ${hexval}";
+               my $ret2 = system($cmd2);
+               if ($ret1 != 0) {
+                       print("\"$cmd2\" failed\n");
+                       return undef;
+               }
+       }
+
        return 1;
 }