From 3e925ee75c6585fa50dacc8222c275da934593a4 Mon Sep 17 00:00:00 2001 From: Yongjie Sheng Date: Sat, 11 Oct 2025 09:49:07 +0800 Subject: [PATCH] add project test for intel-ipsec-mb isa-l_crypto isa-l --- test/Makefile.in | 12 ++++++++++- test/get_build_intel-ipsec-mbtest.sh | 19 +++++++++++++++++ test/get_build_isa-l_cryptotest.sh | 15 +++++++++++++ test/get_build_isa-ltest.sh | 15 +++++++++++++ test/nasm | 2 +- test/projtest.sh | 32 ++++++++++++++++++++-------- 6 files changed, 84 insertions(+), 11 deletions(-) create mode 100755 test/get_build_intel-ipsec-mbtest.sh create mode 100755 test/get_build_isa-l_cryptotest.sh create mode 100755 test/get_build_isa-ltest.sh diff --git a/test/Makefile.in b/test/Makefile.in index f6ab3c9c..b9c2a970 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -19,7 +19,7 @@ TESTS = $(wildcard *.asm) RM_F = rm -f RM_RF = rm -rf -.PHONY: tools nasm ndisasm ffmpegtest x264test dav1dtest +.PHONY: tools nasm ndisasm ffmpegtest x264test dav1dtest intel-ipsec-mbtest isa-ltest isa-l_cryptotest tools: $(MAKE) -C .. all @@ -38,6 +38,15 @@ x264test: dav1dtest: bash projtest.sh '$(NASM)' $@ +intel-ipsec-mbtest: + bash projtest.sh '$(NASM)' $@ + +isa-ltest: + bash projtest.sh '$(NASM)' $@ + +isa-l_cryptotest: + bash projtest.sh '$(NASM)' $@ + %.bin: %.asm $(NASM) $(NASM) $(NASMOPT) -f bin -o $@ -MD $@.dep -l $@.lst $< @@ -123,6 +132,7 @@ clean: $(RM_RF) testresults $(RM_F) elftest elftest64 $(RM_RF) ffmpegtest x264test dav1dtest + $(RM_RF) intel-ipsec-mbtest isa-ltest isa-l_cryptotest spotless: clean $(RM_RF) golden diff --git a/test/get_build_intel-ipsec-mbtest.sh b/test/get_build_intel-ipsec-mbtest.sh new file mode 100755 index 00000000..f6ab3916 --- /dev/null +++ b/test/get_build_intel-ipsec-mbtest.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +: >> "$filelist" + +if [ -d intel-ipsec-mb/.git ]; then + cd intel-ipsec-mb + git reset --hard + xargs -r rm -f < "$filelist" + rm -rf build +else + git clone https://github.com/intel/intel-ipsec-mb.git + cd intel-ipsec-mb +fi + +: > "$filelist" +mkdir -p build +cd build +cmake .. +cmake --build . --parallel diff --git a/test/get_build_isa-l_cryptotest.sh b/test/get_build_isa-l_cryptotest.sh new file mode 100755 index 00000000..b932fc51 --- /dev/null +++ b/test/get_build_isa-l_cryptotest.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +: >> "$filelist" + +if [ -d isa-l_crypto/.git ]; then + cd isa-l_crypto + git reset --hard + xargs -r rm -f < "$filelist" + make clean +else + git clone https://github.com/intel/isa-l_crypto.git isa-l_crypto + cd isa-l_crypto +fi +: > "$filelist" +make -f Makefile.unx -j diff --git a/test/get_build_isa-ltest.sh b/test/get_build_isa-ltest.sh new file mode 100755 index 00000000..d718f19b --- /dev/null +++ b/test/get_build_isa-ltest.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +: >> "$filelist" + +if [ -d isa-l/.git ]; then + cd isa-l + git reset --hard + xargs -r rm -f < "$filelist" + make clean +else + git clone https://github.com/intel/isa-l.git isa-l + cd isa-l +fi +: > "$filelist" +make -f Makefile.unx -j diff --git a/test/nasm b/test/nasm index d7b6ec33..fe95e5ba 100755 --- a/test/nasm +++ b/test/nasm @@ -32,8 +32,8 @@ done printf '%s\n' "$*" >> "$projnasm_logfile" rm -f "$ofile" +"$projnasm_nasm2" "${param2[@]}" "$projnasm_nasm1" "${param1[@]}" || exit $? -"$projnasm_nasm2" "${param2[@]}" || exit $? if [ -f $ofile.1 ]; then cp -f "$ofile.1" "$ofile" fi diff --git a/test/projtest.sh b/test/projtest.sh index 165a84f6..ca763867 100755 --- a/test/projtest.sh +++ b/test/projtest.sh @@ -48,37 +48,51 @@ if [ "$rev" -ne "0" ]; then fi set +x +tmpf=$(mktemp) { for y in "o" "obj" do for x in $(grep -o -P "\-o .*\.${y}" $logfile | sed -e 's/-o //') do + f=$x if ! [ -f $x ]; then + b=$(basename $x) + if find -name $b >/dev/null; then + find -name $b >$tmpf + while read -r line; do + if [[ "$line" == *"$x" ]]; then + f=$line + fi + done < "$tmpf" + fi + fi + if ! [ -f $f ]; then # probably it's a temporary assembly being tested continue fi - if ! [ -f ${x}.1 ]; then - echo file ${x}.1 does not exist + if ! [ -f ${f}.1 ]; then + echo file ${f}.1 does not exist fi - if ! [ -f ${x}.2 ]; then - echo file ${x}.2 does not exist + if ! [ -f ${f}.2 ]; then + echo file ${f}.2 does not exist fi - objdump -d ${x}.1 | tail -n +4 >/tmp/1.dump - objdump -d ${x}.2 | tail -n +4 >/tmp/2.dump + objdump -d ${f}.1 | tail -n +4 >/tmp/1.dump + objdump -d ${f}.2 | tail -n +4 >/tmp/2.dump if ! diff /tmp/1.dump /tmp/2.dump >/dev/null; then - echo [differs] $x - #diff /tmp/1.dump /tmp/2.dump + echo [differs] $f + #diff -u /tmp/1.dump /tmp/2.dump else - echo [matches] $x + echo [matches] $f fi rm -f /tmp/1.dump /tmp/2.dump done done } | tee "$here/results" +rm -f $tmpf rev=$(! grep -e " does not exist" -e "\[differs\]" $here/results >/dev/null) exit $rev