# libtalloc 2.4.2 (Samba's hierarchical reference-counted allocator) -- BRINTOS-515. # # Drives UPSTREAM's own ptest suite under ptest-runner and scores it against a native # x86_64 control built from the identical tarball with the identical patches # (data/libtalloc-native.txt, regenerated by src/libtalloc_mknative.sh). The control # fixes the case names and the expected count BEFORE the image is booted, so a target # red is a statement about this arm rather than about the suite. # # TWO LAYERS, AND THEY COME FROM DIFFERENT PLACES. run-ptest reports one verdict per # BINARY -- two lines for ~50 cases -- and it redirects each binary's own stdout into # tests/.out, so the per-case "success: " lines never reach # ptest-runner. The control therefore carries both, and this file reads each from # where it actually appears: # PASS: ptest-runner's stdout # CASE: / tests/.out, written by upstream's own wrapper # Layer 2 is what makes a red name the case that regressed instead of the binary # that contains it. # # It then asserts what the ptest structurally CANNOT speak for. Both binaries are # statically linked, so the whole suite would pass unchanged on an image where the # shipped archive, header and pkg-config file were all missing -- the ptest tests the # code, not the port. # # BST-TIMEOUT: 300 # ~50 cases across two fresh guest processes, plus ptest-runner's # # own per-suite setup; 60 s is tight on a loaded host and a trip # # costs the whole run's sentinel. . "$BST_LIB" PT=/usr/lib/libtalloc/ptest CTL=$BST_DATA/libtalloc-native.txt require ptest-runner libtalloc/present # --------------------------------------------------------------------------- # 1. What the port ships. The ptest cannot fail on any of these being absent. # --------------------------------------------------------------------------- # # There is no bare libtalloc package to assert: on a static-only arm FILES:${PN} is a # .so glob that matches nothing, so the port IS the archive, the header and the .pc. check libtalloc/archive test -s /usr/lib/libtalloc.a check libtalloc/header test -s /usr/include/talloc.h check libtalloc/pkgconfig test -s /usr/lib/pkgconfig/talloc.pc # ...and they have to carry the real thing, not just exist: a packaging pass that # shipped a truncated archive or a stub header passes the size checks above and # nothing else here would notice. check libtalloc/header-api grep -q talloc_named_const /usr/include/talloc.h check_out libtalloc/pc-version "2.4.2" sh -c "sed -n 's/^Version: //p' /usr/lib/pkgconfig/talloc.pc" # The suite payload itself, so a truncated ptest package is not read as a short run. check libtalloc/ptest-runptest test -x $PT/run-ptest check libtalloc/ptest-replace test -x $PT/tests/replace_testsuite check libtalloc/ptest-talloc test -x $PT/tests/talloc_testsuite # --------------------------------------------------------------------------- # 2. Upstream's suite, under ptest-runner, joined against the native control. # --------------------------------------------------------------------------- if [ ! -s "$CTL" ]; then bst_notok libtalloc/control-present "native control $CTL missing or empty" return 0 2>/dev/null || exit 0 fi bst_ok libtalloc/control-present out=$(ptest-runner libtalloc 2>&1) detail=$(cat "$PT/tests/replace_testsuite.out" "$PT/tests/talloc_testsuite.out" 2>/dev/null) # run-ptest redirects into its own directory, so on a read-only or non-writable # rootfs the redirect fails, every case reads as absent, and layer 2 goes solidly red # for a reason that has nothing to do with talloc. Name that cause once, here, rather # than leaving ~50 unexplained reds behind it. if [ -z "$detail" ]; then bst_notok libtalloc/case-detail-present \ "no tests/*.out from run-ptest -- is $PT writable? every CASE below is unscorable" else bst_ok libtalloc/case-detail-present fi # Layer 1 -- run-ptest's own verdict per binary, driven from the control so a binary # the target never reported is a red rather than a silently shorter run. while read -r verdict name; do [ "$verdict" = "PASS:" ] || continue if printf '%s\n' "$out" | grep -qx "PASS: $name"; then bst_ok "libtalloc/bin-$name" else got=$(printf '%s\n' "$out" | grep -xE "(FAIL|SKIP): $name" | head -1) bst_notok "libtalloc/bin-$name" "native PASS, target: ${got:-}" fi done < "$CTL" # Layer 2 -- every case the control proved green natively must be green here. The # binaries print "success: " per case; a case that ran and failed prints no # such line, which is what makes the absence meaningful. while read -r tag path; do [ "$tag" = "CASE:" ] || continue case=${path#*/} if printf '%s\n' "$detail" | grep -qx "success: $case"; then bst_ok "libtalloc/case-$case" else why="native success, target: no 'success: $case' line" # Two cases cannot run once an earlier one has failed, and saying so is the # difference between one cause and three. Upstream gates test_speed() behind # `if (ret)` -- every prior case green -- and test_magic_free_protection() # runs after test_magic_protection(), which takes the whole process down here. case $case in speed) printf '%s\n' "$detail" | grep -qx 'success: pthread_talloc_passing' \ || why="$why (not started: upstream runs test_speed only 'if (ret)', and pthread_talloc_passing failed first)" ;; magic_free_protection) printf '%s\n' "$detail" | grep -qx 'success: magic_protection' \ || why="$why (not started: the binary died inside magic_protection, which runs before it)" ;; esac bst_notok "libtalloc/case-$case" "$why" fi done < "$CTL" # Completeness: as many cases reported as the control has. This is what catches a # TRUNCATED run whose visible cases all happen to be green, which a per-case-only # report cannot see. # # THE TARGET SIDE MUST BE COUNTED WITH THE CONTROL'S OWN CASE-NAME SHAPE, or the two # layers disagree and the count is the one that is wrong. src/libtalloc_mknative.sh # accepts only [A-Za-z0-9_.-]+ as a case name, which deliberately excludes upstream's # one banner line -- talloc's realloc-with-child test prints "success: REALLOC WITH # CHILD" instead of a case name. Counting bare '^success: ' here included that banner # and reported 44 against 50 while seven cases were actually missing. nctl=$(grep -c '^CASE: ' "$CTL") ntgt=$(printf '%s\n' "$detail" | grep -cE '^success: [A-Za-z0-9_.-]+$') check_eq libtalloc/join-complete "$nctl" "$ntgt" # ptest-runner reached the end of the suite rather than dying inside it. case "$out" in *"END: /usr/lib/libtalloc/ptest"*) bst_ok libtalloc/ptest-completed ;; *) bst_notok libtalloc/ptest-completed "no END marker; $(_bst_1line "$out")" ;; esac