Add project test for cryptography-primitives

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
Yongjie Sheng 2025-10-11 20:50:26 +08:00 committed by H. Peter Anvin (Intel)
parent 00fe1077dc
commit 8058e5df17
3 changed files with 30 additions and 6 deletions

View file

@ -19,7 +19,7 @@ TESTS = $(wildcard *.asm)
RM_F = rm -f
RM_RF = rm -rf
.PHONY: tools nasm ndisasm ffmpegtest x264test dav1dtest intel-ipsec-mbtest isa-ltest isa-l_cryptotest
.PHONY: tools nasm ndisasm ffmpegtest x264test dav1dtest intel-ipsec-mbtest isa-ltest isa-l_cryptotest cryptography-primitivestest
tools:
$(MAKE) -C .. all
@ -47,6 +47,9 @@ isa-ltest:
isa-l_cryptotest:
bash projtest.sh '$(NASM)' $@
cryptography-primitivestest:
bash projtest.sh '$(NASM)' $@
%.bin: %.asm $(NASM)
$(NASM) $(NASMOPT) -f bin -o $@ -MD $@.dep -l $@.lst $<
@ -132,7 +135,7 @@ clean:
$(RM_RF) testresults
$(RM_F) elftest elftest64
$(RM_RF) ffmpegtest x264test dav1dtest
$(RM_RF) intel-ipsec-mbtest isa-ltest isa-l_cryptotest
$(RM_RF) intel-ipsec-mbtest isa-ltest isa-l_cryptotest cryptography-primitivestest
spotless: clean
$(RM_RF) golden

View file

@ -0,0 +1,19 @@
#!/bin/bash
: >> "$filelist"
if [ -d cryptography-primitives/.git ]; then
cd cryptography-primitives
git reset --hard
xargs -r rm -f < "$filelist"
CC=gcc CXX=g++ cmake CMakeLists.txt -B_build -DARCH=intel64 -DCMAKE_ASM_NASM_COMPILER=nasm
cd _build
make clean
else
git clone https://github.com/intel/cryptography-primitives.git cryptography-primitives
cd cryptography-primitives
CC=gcc CXX=g++ cmake CMakeLists.txt -B_build -DARCH=intel64 -DCMAKE_ASM_NASM_COMPILER=nasm
cd _build
fi
: > "$filelist"
make all -j4

View file

@ -11,7 +11,9 @@ fi
NASM2="$1"
[ -z "$NASM2" ] && NASM2=../nasm
NASM2=$(which "$NASM2" 2>/dev/null)
# which does not work for Ubuntu on a relative path executable
# NASM2=$(which "$NASM2" 2>/dev/null)
NASM2=${PWD}/${NASM2}
if [ -z "$NASM2" ]; then
echo 'Test nasm not found' 1>&2
exit 1
@ -79,11 +81,11 @@ do
echo file ${f}.2 does not exist
fi
objdump -d ${f}.1 | tail -n +4 >/tmp/1.dump
objdump -d ${f}.2 | tail -n +4 >/tmp/2.dump
objdump -d --no-show-raw-insn --no-addresses ${f}.1 | tail -n +4 >/tmp/1.dump
objdump -d --no-show-raw-insn --no-addresses ${f}.2 | tail -n +4 >/tmp/2.dump
if ! diff /tmp/1.dump /tmp/2.dump >/dev/null; then
echo [differs] $f
#diff -u /tmp/1.dump /tmp/2.dump
diff -u /tmp/1.dump /tmp/2.dump
else
echo [matches] $f
fi