mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-17 12:34:35 +03:00
Split assembler tests so they can compile much faster with GCC
This commit is contained in:
@@ -510,6 +510,7 @@ if (NOT ASMJIT_EMBED)
|
|||||||
|
|
||||||
asmjit_add_target(asmjit_test_assembler TEST
|
asmjit_add_target(asmjit_test_assembler TEST
|
||||||
SOURCES test/asmjit_test_assembler.cpp
|
SOURCES test/asmjit_test_assembler.cpp
|
||||||
|
test/asmjit_test_assembler_x64.cpp
|
||||||
test/asmjit_test_assembler_x86.cpp
|
test/asmjit_test_assembler_x86.cpp
|
||||||
test/asmjit_test_assembler.h
|
test/asmjit_test_assembler.h
|
||||||
LIBRARIES asmjit::asmjit
|
LIBRARIES asmjit::asmjit
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ public:
|
|||||||
|
|
||||||
AssemblerTester(uint32_t arch, const TestSettings& settings) noexcept
|
AssemblerTester(uint32_t arch, const TestSettings& settings) noexcept
|
||||||
: env(arch),
|
: env(arch),
|
||||||
settings(settings) {}
|
settings(settings) {
|
||||||
|
prepare();
|
||||||
|
}
|
||||||
|
|
||||||
void printHeader(const char* archName) noexcept {
|
void printHeader(const char* archName) noexcept {
|
||||||
printf("%s assembler tests:\n", archName);
|
printf("%s assembler tests:\n", archName);
|
||||||
@@ -56,17 +58,19 @@ public:
|
|||||||
|
|
||||||
bool didPass() const noexcept { return passed == count; }
|
bool didPass() const noexcept { return passed == count; }
|
||||||
|
|
||||||
void beforeInstruction() noexcept {
|
void prepare() noexcept {
|
||||||
|
code.reset();
|
||||||
code.init(env, 0);
|
code.init(env, 0);
|
||||||
code.attach(&assembler);
|
code.attach(&assembler);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool testInstruction(const char* expectedOpcode, const char* s, uint32_t err) noexcept {
|
ASMJIT_NOINLINE bool testInstruction(const char* expectedOpcode, const char* s, uint32_t err) noexcept {
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
printf(" !! %s\n"
|
printf(" !! %s\n"
|
||||||
" <%s>\n", s, asmjit::DebugUtils::errorAsString(err));
|
" <%s>\n", s, asmjit::DebugUtils::errorAsString(err));
|
||||||
|
prepare();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +81,7 @@ public:
|
|||||||
if (encodedOpcode != expectedOpcode) {
|
if (encodedOpcode != expectedOpcode) {
|
||||||
printf(" !! [%s] <- %s\n"
|
printf(" !! [%s] <- %s\n"
|
||||||
" [%s] (Expected)\n", encodedOpcode.data(), s, expectedOpcode);
|
" [%s] (Expected)\n", encodedOpcode.data(), s, expectedOpcode);
|
||||||
|
prepare();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,13 +89,9 @@ public:
|
|||||||
printf(" OK [%s] <- %s\n", encodedOpcode.data(), s);
|
printf(" OK [%s] <- %s\n", encodedOpcode.data(), s);
|
||||||
|
|
||||||
passed++;
|
passed++;
|
||||||
|
prepare();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void afterInstruction() noexcept {
|
|
||||||
code.reset();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ASMJIT_TEST_ASSEMBLER_H_INCLUDED
|
#endif // ASMJIT_TEST_ASSEMBLER_H_INCLUDED
|
||||||
|
|
||||||
|
|||||||
8228
test/asmjit_test_assembler_x64.cpp
Normal file
8228
test/asmjit_test_assembler_x64.cpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user