Remove HARNESS_OSSL_PREFIX manipulation in the test harness

The aim of HARNESS_OSSL_PREFIX environment variable is to avoid contaminating
TAP producer's output with stanzas that can be interpreted by a TAP producer
by prefixing them with comment;  this can be achieved by processing
the output within the runner instead, as it already does for non-standard
prefixes;  it also has the added benefit of alleviating the need
to reset it for the external tests in order to avoid messing
with their output checks.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28025)
This commit is contained in:
Eugene Syromiatnikov 2025-07-21 13:32:24 +02:00 committed by Neil Horman
parent e08b83cbb3
commit 70c05fcde5
4 changed files with 18 additions and 23 deletions

View File

@ -48,7 +48,6 @@ echo "------------------------------------------------------------------"
cmake $SRCTOP/gost-engine -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -DOPENSSL_ENGINES_DIR="$OPENSSL_ROOT_DIR/engines"
make
export CTEST_OUTPUT_ON_FAILURE=1
export HARNESS_OSSL_PREFIX=''
export OPENSSL_ENGINES="$PWD/bin"
export OPENSSL_APP="$O_EXE/openssl"
make test

View File

@ -65,7 +65,6 @@ fi
echo " CWD: $PWD"
liboqs_DIR=$SRCTOP/oqs-provider/.local cmake $SRCTOP/oqs-provider -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -B _build && cmake --build _build
export CTEST_OUTPUT_ON_FAILURE=1
export HARNESS_OSSL_PREFIX=''
export OPENSSL_APP="$O_EXE/openssl"
export OPENSSL_MODULES=$PWD/_build/lib
export OQS_PROVIDER_TESTSCRIPTS=$SRCTOP/oqs-provider/scripts

View File

@ -63,9 +63,8 @@ echo "------------------------------------------------------------------"
echo "Running tests"
echo "------------------------------------------------------------------"
# The OpenSSL app uses ${HARNESS_OSSL_PREFIX} as a prefix for its standard output
# For maintenance reasons and simplicity we only run test with kryoptic token
HARNESS_OSSL_PREFIX= meson test -C $PKCS11_PROVIDER_BUILDDIR --suite=kryoptic
meson test -C $PKCS11_PROVIDER_BUILDDIR --suite=kryoptic
if [ $? -ne 0 ]; then
cat $PKCS11_PROVIDER_BUILDDIR/meson-logs/testlog.txt

View File

@ -465,29 +465,27 @@ sub run {
$ENV{HARNESS_OSSL_LEVEL} = $level + 1;
# We prefix the output with "# " in non-capture mode by default to avoid
# its interpretation by the TAP consumer.
my $default_prefix = $opts{capture} ? "" : "# ";
my $pipe;
local $_;
open($pipe, '-|', "$prefix$cmd") or die "Can't start command: $!";
while(<$pipe>) {
my $l = ($opts{prefix} // $default_prefix) . $_;
if ($opts{capture}) {
push @r, $l;
} else {
print STDOUT $l;
}
}
close $pipe;
# The dance we do with $? is the same dance the Unix shells appear to
# do. For example, a program that gets aborted (and therefore signals
# SIGABRT = 6) will appear to exit with the code 134. We mimic this
# to make it easier to compare with a manual run of the command.
if ($opts{capture} || defined($opts{prefix})) {
my $pipe;
local $_;
open($pipe, '-|', "$prefix$cmd") or die "Can't start command: $!";
while(<$pipe>) {
my $l = ($opts{prefix} // "") . $_;
if ($opts{capture}) {
push @r, $l;
} else {
print STDOUT $l;
}
}
close $pipe;
} else {
$ENV{HARNESS_OSSL_PREFIX} = "# ";
system("$prefix$cmd");
delete $ENV{HARNESS_OSSL_PREFIX};
}
$e = ($? & 0x7f) ? ($? & 0x7f)|0x80 : ($? >> 8);
$r = $hooks{exit_checker}->($e);
if ($opts{statusvar}) {