From 1ab91e60ce9d3d6f5e16685ffd13fb52a8439eb4 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Thu, 21 Nov 2024 18:16:33 +0100 Subject: [PATCH] abi: fix unit test for abi on linux --- tests/frontend/abi.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/frontend/abi.sh b/tests/frontend/abi.sh index 522441c9e..66bc3c8cc 100644 --- a/tests/frontend/abi.sh +++ b/tests/frontend/abi.sh @@ -8,12 +8,22 @@ tests_init \ override native_body() { - _expected="$(uname -s):$(uname -r | cut -d. -f1):$(uname -p | sed s/x86_64/amd64/)\n" + thisarch=$(uname -p) + if [ "$thisarch" = "unknonw" ]; then + thisarch=$(uname -m) + fi + OS=$(uname -s) + if [ "${OS}" = "Linux" ]; then + version=$(readelf -n /bin/uname | awk '/ABI: / { split($NF, a, "."); print a[1]"."a[2] }') + else + version=$(uname -r | cut -d. -f1) + fi + _expected="${OS}:${version}:$(echo $thisarch | sed s/x86_64/amd64/)\n" atf_check \ -o inline:"${_expected}" \ pkg config abi - _expected="$(uname -s | tr '[:upper:]' '[:lower:]'):$(uname -r | cut -d. -f1):$(uname -p | sed 's/x86_64/x86:64/; s/amd64/x86:64/')\n" + _expected="$(uname -s | tr '[:upper:]' '[:lower:]'):${version}:$(echo $thisarch | sed 's/x86_64/x86:64/; s/amd64/x86:64/')\n" atf_check \ -o inline:"${_expected}" \ pkg config altabi