mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Add migration test
This commit is contained in:
committed by
Alessandro Di Federico
parent
6cdf2b74cb
commit
3fc2971e33
@@ -254,3 +254,16 @@ add_crash_test(crash_test_sigtrap 5 134)
|
||||
add_crash_test(crash_test_sigbus 7 134)
|
||||
|
||||
add_crash_test(crash_test_sigfpe 8 134)
|
||||
|
||||
#
|
||||
# Automatic migration tests
|
||||
#
|
||||
|
||||
revng_add_test(
|
||||
NAME
|
||||
automatic_migration_test
|
||||
COMMAND
|
||||
bash
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/run_migration_test.sh
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_BINARY_DIR})
|
||||
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
log() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
log_file() {
|
||||
cat "$@" >&2
|
||||
}
|
||||
|
||||
TEST_DIR=$(mktemp -d)
|
||||
|
||||
trap 'rm --recursive --force "${TEST_DIR}"' EXIT
|
||||
|
||||
mkdir --parents "${TEST_DIR}"/resume-dir/context
|
||||
|
||||
cat > "${TEST_DIR}"/resume-dir/context/model.yml <<EOF
|
||||
Version: 1
|
||||
Configuration:
|
||||
Disassembly:
|
||||
UseATTSyntax: true
|
||||
EOF
|
||||
|
||||
./bin/revng artifact --resume "${TEST_DIR}"/resume-dir decompile-to-single-file /dev/null
|
||||
|
||||
USE_ATT_SYNTAX=$(yq '.Configuration.Disassembly.UseATTSyntax' "${TEST_DIR}"/resume-dir/context/model.yml)
|
||||
USE_X86_ATT_SYNTAX=$(yq '.Configuration.Disassembly.UseX86ATTSyntax' "${TEST_DIR}"/resume-dir/context/model.yml)
|
||||
|
||||
if [ "${USE_ATT_SYNTAX}" != "null" ]; then
|
||||
log "Expected UseATTSyntax = null, but got ${USE_ATT_SYNTAX} instead"
|
||||
log "Here's the migrated file for reference"
|
||||
log_file "${TEST_DIR}"/resume-dir/context/model.yml
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${USE_X86_ATT_SYNTAX}" != "true" ]; then
|
||||
log "Expected UseX86ATTSyntax = true, but got ${USE_X86_ATT_SYNTAX} instead"
|
||||
log "Here's the migrated file for reference"
|
||||
log_file "${TEST_DIR}"/resume-dir/context/model.yml
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user