travis: Test with disabled CPU feature detection
Ensure that fallbacks are working correctly.
This commit is contained in:
parent
285fd22c30
commit
30936f5e94
6 changed files with 57 additions and 3 deletions
21
.travis.yml
21
.travis.yml
|
@ -2,7 +2,8 @@ language: cpp
|
|||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
- env: NAME="Linux Build"
|
||||
os: linux
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
|
@ -13,7 +14,8 @@ matrix:
|
|||
- g++-7
|
||||
install: ./.travis/build-x86_64-linux/deps.sh
|
||||
script: ./.travis/build-x86_64-linux/build.sh
|
||||
- os: linux
|
||||
- env: NAME="Test - Fuzz against Unicorn"
|
||||
os: linux
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
|
@ -24,7 +26,20 @@ matrix:
|
|||
- g++-7
|
||||
install: ./.travis/test-a64-on-x86_64-linux/deps.sh
|
||||
script: ./.travis/test-a64-on-x86_64-linux/build.sh
|
||||
- os: osx
|
||||
- env: NAME="Test - SSE3 only"
|
||||
os: linux
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-7
|
||||
- g++-7
|
||||
install: ./.travis/sse3-only-on-x86_64-linux/deps.sh
|
||||
script: ./.travis/sse3-only-on-x86_64-linux/build.sh
|
||||
- env: NAME="macOS Build"
|
||||
os: osx
|
||||
sudo: false
|
||||
osx_image: xcode9.2
|
||||
install: ./.travis/build-x86_64-macos/deps.sh
|
||||
|
|
15
.travis/sse3-only-on-x86_64-linux/build.sh
Executable file
15
.travis/sse3-only-on-x86_64-linux/build.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
export CC=gcc-7
|
||||
export CXX=g++-7
|
||||
export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
export UNICORNDIR=$(pwd)/externals/unicorn
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DCMAKE_BUILD_TYPE=Release -DDYNARMIC_TESTS_USE_UNICORN=1 -DDYNARMIC_ENABLE_CPU_FEATURE_DETECTION=0
|
||||
make -j4
|
||||
|
||||
./tests/dynarmic_tests --durations yes
|
16
.travis/sse3-only-on-x86_64-linux/deps.sh
Executable file
16
.travis/sse3-only-on-x86_64-linux/deps.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# TODO: This isn't ideal.
|
||||
cd externals
|
||||
git clone https://github.com/MerryMage/ext-boost
|
||||
git clone https://github.com/MerryMage/unicorn
|
||||
cd unicorn
|
||||
UNICORN_ARCHS=aarch64 ./make.sh
|
||||
cd ../..
|
||||
|
||||
mkdir -p $HOME/.local
|
||||
curl -L https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.tar.gz \
|
||||
| tar -xz -C $HOME/.local --strip-components=1
|
|
@ -9,6 +9,7 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|||
endif()
|
||||
|
||||
# Dynarmic project options
|
||||
option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON)
|
||||
option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF)
|
||||
option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT})
|
||||
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
|
||||
|
|
|
@ -167,6 +167,9 @@ target_link_libraries(dynarmic
|
|||
xbyak
|
||||
$<$<BOOL:DYNARMIC_USE_LLVM>:${llvm_libs}>
|
||||
)
|
||||
if (DYNARMIC_ENABLE_CPU_FEATURE_DETECTION)
|
||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_CPU_FEATURE_DETECTION=1)
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0)
|
||||
endif()
|
||||
|
|
|
@ -235,7 +235,11 @@ void BlockOfCode::EnsurePatchLocationSize(CodePtr begin, size_t size) {
|
|||
}
|
||||
|
||||
bool BlockOfCode::DoesCpuSupport(Xbyak::util::Cpu::Type type) const {
|
||||
#ifdef DYNARMIC_ENABLE_CPU_FEATURE_DETECTION
|
||||
return cpu_info.has(type);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace BackendX64
|
||||
|
|
Loading…
Reference in a new issue