travis: Run A64 tests
This commit is contained in:
parent
4e3675da7b
commit
a59e9ad9c6
12 changed files with 61 additions and 23 deletions
20
.travis.yml
20
.travis.yml
|
@ -3,7 +3,6 @@ language: cpp
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: required
|
|
||||||
dist: trusty
|
dist: trusty
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
@ -12,10 +11,21 @@ matrix:
|
||||||
packages:
|
packages:
|
||||||
- gcc-7
|
- gcc-7
|
||||||
- g++-7
|
- g++-7
|
||||||
install: ./.travis/deps-x86_64-linux.sh
|
install: ./.travis/build-x86_64-linux/deps.sh
|
||||||
script: ./.travis/build-x86_64-linux.sh
|
script: ./.travis/build-x86_64-linux/build.sh
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- gcc-7
|
||||||
|
- g++-7
|
||||||
|
install: ./.travis/test-a64-on-x86_64-linux/deps.sh
|
||||||
|
script: ./.travis/test-a64-on-x86_64-linux/build.sh
|
||||||
- os: osx
|
- os: osx
|
||||||
sudo: false
|
sudo: false
|
||||||
osx_image: xcode9.2
|
osx_image: xcode9.2
|
||||||
install: ./.travis/deps-x86_64-macos.sh
|
install: ./.travis/build-x86_64-macos/deps.sh
|
||||||
script: ./.travis/build-x86_64-macos.sh
|
script: ./.travis/build-x86_64-macos/build.sh
|
||||||
|
|
|
@ -8,7 +8,7 @@ export CXX=g++-7
|
||||||
export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
|
export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||||
|
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake .. -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DCMAKE_BUILD_TYPE=Release
|
cmake .. -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DCMAKE_BUILD_TYPE=Release
|
||||||
make -j4
|
make -j4
|
||||||
|
|
||||||
ctest -VV -C Release
|
ctest -VV -C Release
|
|
@ -7,5 +7,5 @@ set -o pipefail
|
||||||
export MACOSX_DEPLOYMENT_TARGET=10.9
|
export MACOSX_DEPLOYMENT_TARGET=10.9
|
||||||
|
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake .. -GXcode -DDYNARMIC_USE_SYSTEM_BOOST=0 -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DDYNARMIC_TESTS=0
|
cmake .. -GXcode -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DDYNARMIC_TESTS=0
|
||||||
xcodebuild -configuration Release
|
xcodebuild -configuration Release
|
15
.travis/test-a64-on-x86_64-linux/build.sh
Executable file
15
.travis/test-a64-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
|
||||||
|
make -j4
|
||||||
|
|
||||||
|
ctest -VV -C Release
|
16
.travis/test-a64-on-x86_64-linux/deps.sh
Executable file
16
.travis/test-a64-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,7 +9,6 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Dynarmic project options
|
# Dynarmic project options
|
||||||
option(DYNARMIC_USE_SYSTEM_BOOST "Use the system boost libraries" ON)
|
|
||||||
option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF)
|
option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF)
|
||||||
option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT})
|
option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT})
|
||||||
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
|
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
|
||||||
|
@ -127,10 +126,12 @@ if (DYNARMIC_USE_LLVM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DYNARMIC_TESTS_USE_UNICORN)
|
if (DYNARMIC_TESTS_USE_UNICORN)
|
||||||
find_package(unicorn REQUIRED)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
add_library(unicorn INTERFACE)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(unicorn INTERFACE "${LIBUNICORN_LIBRARY}")
|
find_package(Unicorn REQUIRED)
|
||||||
target_include_directories(unicorn INTERFACE "${LIBUNICORN_INCLUDE_DIR}")
|
add_library(Unicorn INTERFACE)
|
||||||
|
target_link_libraries(Unicorn INTERFACE "${LIBUNICORN_LIBRARY}" Threads::Threads)
|
||||||
|
target_include_directories(Unicorn INTERFACE "${LIBUNICORN_INCLUDE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Pull in externals CMakeLists for libs where available
|
# Pull in externals CMakeLists for libs where available
|
||||||
|
|
|
@ -350,8 +350,6 @@ void FuzzJitArm(const size_t instruction_count, const size_t instructions_to_exe
|
||||||
#endif
|
#endif
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (run_number % 10 == 0) printf("%zu\r", run_number);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,15 +155,13 @@ static void TestInstance(const std::array<u64, 31>& regs, const std::vector<u32>
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("A64: Single random instruction", "[a64]") {
|
TEST_CASE("A64: Single random instruction", "[a64]") {
|
||||||
for (size_t iteration = 0; iteration < 1000000; ++iteration) {
|
for (size_t iteration = 0; iteration < 10000; ++iteration) {
|
||||||
std::array<u64, 31> regs;
|
std::array<u64, 31> regs;
|
||||||
std::generate_n(regs.begin(), 31, []{ return RandInt<u64>(0, ~u64(0)); });
|
std::generate_n(regs.begin(), 31, []{ return RandInt<u64>(0, ~u64(0)); });
|
||||||
std::vector<u32> instructions;
|
std::vector<u32> instructions;
|
||||||
instructions.push_back(GenRandomInst(0));
|
instructions.push_back(GenRandomInst(0));
|
||||||
u32 pstate = RandInt<u32>(0, 0xF) << 28;
|
u32 pstate = RandInt<u32>(0, 0xF) << 28;
|
||||||
|
|
||||||
printf("%zu: %08x\n", iteration, instructions[0]);
|
|
||||||
|
|
||||||
TestInstance(regs, instructions, pstate);
|
TestInstance(regs, instructions, pstate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ std::array<u64, 31> Unicorn::GetRegisters() const {
|
||||||
for (size_t i = 0; i < num_gprs; ++i)
|
for (size_t i = 0; i < num_gprs; ++i)
|
||||||
ptrs[i] = ®s[i];
|
ptrs[i] = ®s[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_read_batch(uc, (int*)gpr_ids.data(), (void**)ptrs.data(), num_gprs));
|
CHECKED(uc_reg_read_batch(uc, const_cast<int*>(gpr_ids.data()), (void**)ptrs.data(), num_gprs));
|
||||||
return regs;
|
return regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void Unicorn::SetRegisters(const std::array<u64, 31>& value) {
|
||||||
for (size_t i = 0; i < num_gprs; ++i)
|
for (size_t i = 0; i < num_gprs; ++i)
|
||||||
ptrs[i] = &value[i];
|
ptrs[i] = &value[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_write_batch(uc, (int*)gpr_ids.data(), (void**)ptrs.data(), num_gprs));
|
CHECKED(uc_reg_write_batch(uc, const_cast<int*>(gpr_ids.data()), (void**)ptrs.data(), num_gprs));
|
||||||
}
|
}
|
||||||
|
|
||||||
using Vector = Unicorn::Vector;
|
using Vector = Unicorn::Vector;
|
||||||
|
@ -100,7 +100,7 @@ std::array<Vector, 32> Unicorn::GetVectors() const {
|
||||||
for (size_t i = 0; i < num_vecs; ++i)
|
for (size_t i = 0; i < num_vecs; ++i)
|
||||||
ptrs[i] = &vecs[i];
|
ptrs[i] = &vecs[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_read_batch(uc, (int*)vec_ids.data(), (void**)ptrs.data(), num_vecs));
|
CHECKED(uc_reg_read_batch(uc, const_cast<int*>(vec_ids.data()), (void**)ptrs.data(), num_vecs));
|
||||||
|
|
||||||
return vecs;
|
return vecs;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ void Unicorn::SetVectors(const std::array<Vector, 32>& value) {
|
||||||
for (size_t i = 0; i < num_vecs; ++i)
|
for (size_t i = 0; i < num_vecs; ++i)
|
||||||
ptrs[i] = &value[i];
|
ptrs[i] = &value[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_write_batch(uc, (int*)vec_ids.data(), (void**)ptrs.data(), num_vecs));
|
CHECKED(uc_reg_write_batch(uc, const_cast<int*>(vec_ids.data()), (void**)ptrs.data(), num_vecs));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Unicorn::GetFpcr() const {
|
u32 Unicorn::GetFpcr() const {
|
||||||
|
@ -171,7 +171,7 @@ bool Unicorn::UnmappedMemoryHook(uc_engine* uc, uc_mem_type /*type*/, u64 start_
|
||||||
Unicorn* this_ = reinterpret_cast<Unicorn*>(user_data);
|
Unicorn* this_ = reinterpret_cast<Unicorn*>(user_data);
|
||||||
|
|
||||||
const auto generate_page = [&](u64 base_address) {
|
const auto generate_page = [&](u64 base_address) {
|
||||||
printf("generate_page(%" PRIx64 ")\n", base_address);
|
// printf("generate_page(%" PRIx64 ")\n", base_address);
|
||||||
|
|
||||||
const u32 permissions = [&]{
|
const u32 permissions = [&]{
|
||||||
if (base_address < this_->testenv.code_mem.size() * 4)
|
if (base_address < this_->testenv.code_mem.size() * 4)
|
||||||
|
|
|
@ -39,7 +39,7 @@ if (DYNARMIC_TESTS_USE_UNICORN)
|
||||||
A64/unicorn_emu/unicorn.h
|
A64/unicorn_emu/unicorn.h
|
||||||
A64/unicorn_emu/unicorn_load.cpp
|
A64/unicorn_emu/unicorn_load.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(dynarmic_tests PRIVATE unicorn)
|
target_link_libraries(dynarmic_tests PRIVATE Unicorn)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CreateDirectoryGroups)
|
include(CreateDirectoryGroups)
|
||||||
|
|
Loading…
Reference in a new issue