From 0ae39d72a275876cd777993294e2e1d3684b3ed0 Mon Sep 17 00:00:00 2001 From: Andrea Gussoni Date: Wed, 3 Jun 2026 15:06:14 +0200 Subject: [PATCH] tests: filecheck IR after detect-abi inlining Verify that softfloat helper calls become visible after the helper inlining phase in `DetectABI`. Merge the previous tests for softfloat and these new ones in a single file, since they use the same ground truth file. --- .../revng/floating-point-helpers-inlining.yml | 49 +++++++++++++++++++ .../configuration/revng/floating-point.yml | 26 ---------- 2 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 share/revng/test/configuration/revng/floating-point-helpers-inlining.yml delete mode 100644 share/revng/test/configuration/revng/floating-point.yml diff --git a/share/revng/test/configuration/revng/floating-point-helpers-inlining.yml b/share/revng/test/configuration/revng/floating-point-helpers-inlining.yml new file mode 100644 index 000000000..279026a63 --- /dev/null +++ b/share/revng/test/configuration/revng/floating-point-helpers-inlining.yml @@ -0,0 +1,49 @@ +# +# This file is distributed under the MIT License. See LICENSE.md for details. +# + +# End-to-end tests that verify the emergence of the softfloat calls, on the same +# `for-floating-point-helpers-inlining` ground truth, at two points of the +# pipeline: +# * `revng.test-floating-point-helpers-inlining-in-enforce-abi`: +# in the `enforce-abi` artifact; +# * `revng.test-floating-point-helpers-inlining-in-detect-abi`: +# right after helper inlining inside `DetectABI::analyzeABI()`. +# We pass the `--debug-names` flag to easily anchor the `CHECK` directives for +# multiple function names. +# The CHECK-64 prefix is used for 64-bit-only tests. + +commands: + - type: revng.test-floating-point-helpers-inlining-in-enforce-abi + from: + - type: revng-qa.compiled-with-debug-info + # i386 is excluded until x87 FPU support lands. + filter: for-floating-point-helpers-inlining and !i386 + # `revng merge llvm` merges the per-function IR modules emitted by the + # `--tar` artifact into a single module, so we can `FileCheck` them all at + # once. + # The `sed` below strips the `local_` prefix for a coherent FileCheck file. + command: |- + PREFIXES=CHECK ; + [ "$POINTER_SIZE" = "64" ] && PREFIXES=$$PREFIXES,CHECK-64 ; + revng2 quick artifact enforce-abi "$INPUT" --tar -- --debug-names | + revng merge llvm | + sed 's,@local_,@,g' | + FileCheck --check-prefixes=$$PREFIXES "${SOURCE}".filecheck + + - type: revng.test-floating-point-helpers-inlining-in-detect-abi + from: + - type: revng-qa.compiled-with-debug-info + # i386 is excluded until x87 FPU support lands. + filter: for-floating-point-helpers-inlining and !i386 + # The `sed` below strips the `local_` prefix for a coherent FileCheck file. + command: |- + DUMP="$$(temp)" ; + revng2 quick analyze --analyses=parse-binary,detect-abi "$INPUT" + -- --debug-names + --detect-abi-dump-post-helpers-inlining="$$DUMP" + > /dev/null ; + PREFIXES=CHECK ; + [ "$POINTER_SIZE" = "64" ] && PREFIXES=$$PREFIXES,CHECK-64 ; + sed 's,@local_,@,g' "$$DUMP" | + FileCheck --check-prefixes=$$PREFIXES "${SOURCE}".filecheck diff --git a/share/revng/test/configuration/revng/floating-point.yml b/share/revng/test/configuration/revng/floating-point.yml deleted file mode 100644 index e304cd6ad..000000000 --- a/share/revng/test/configuration/revng/floating-point.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# This file is distributed under the MIT License. See LICENSE.md for details. -# - -# End-to-end tests which verify the emergence of the softfloat calls in the -# `enforce-abi` artifact. -# We pass the `--debug-names` flag to easily anchor the `CHECK` directives for -# multiple function names. -# We also strip the `local_` prefix to have a more coherent FileCheck file. -# Since we use the `revng2` pipeline, we need to extract all the generated IRs -# for each isolated function and to concatenated their content to easily match -# the CHECK directives. -# The CHECK-64 prefix is used for 64-bit arch only tests. - -commands: - - type: revng.floating-point - from: - - type: revng-qa.compiled-with-debug-info - filter: for-floating-point and !i386 - command: |- - PREFIXES=CHECK; - file "$INPUT" | grep -q "ELF 64-bit" && PREFIXES="$$PREFIXES,CHECK-64"; - revng2 quick artifact enforce-abi "$INPUT" --tar -- --debug-names | - revng merge llvm | - sed 's,@local_,@,g' | - FileCheck --check-prefixes=$$PREFIXES "${SOURCE}".filecheck;