mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 12:18:30 +09:00
[Feat] (trace-replay): add Linux retrace CI
This commit is contained in:
@@ -170,7 +170,9 @@ add_library(retrace_common STATIC
|
||||
"${APITRACE_ROOT}/retrace/state_writer_ubjson.cpp"
|
||||
"${APITRACE_ROOT}/retrace/ws.cpp")
|
||||
target_compile_definitions(retrace_common PUBLIC RETRACE)
|
||||
target_compile_definitions(retrace_common PRIVATE exit=mobilegl_apitrace_exit)
|
||||
target_compile_definitions(retrace_common PRIVATE
|
||||
exit=mobilegl_apitrace_exit
|
||||
main=mobilegl_apitrace_main)
|
||||
target_compile_options(retrace_common PRIVATE "-include${CMAKE_CURRENT_LIST_DIR}/apitrace_exit.hpp")
|
||||
target_include_directories(retrace_common PUBLIC
|
||||
"${APITRACE_GENERATED_DIR}"
|
||||
@@ -216,7 +218,9 @@ target_include_directories(glretrace_common PUBLIC
|
||||
"${APITRACE_ROOT}/dispatch"
|
||||
"${APITRACE_ROOT}/helpers"
|
||||
"${APITRACE_ROOT}/retrace")
|
||||
target_compile_definitions(glretrace_common PRIVATE exit=mobilegl_apitrace_exit)
|
||||
target_compile_definitions(glretrace_common PRIVATE
|
||||
exit=mobilegl_apitrace_exit
|
||||
main=mobilegl_apitrace_main)
|
||||
target_compile_options(glretrace_common PRIVATE "-include${CMAKE_CURRENT_LIST_DIR}/apitrace_exit.hpp")
|
||||
target_link_libraries(glretrace_common PUBLIC retrace_common glhelpers glproc)
|
||||
|
||||
@@ -225,6 +229,8 @@ add_library(trace_replay_runner SHARED
|
||||
trace_replay_jni.cpp)
|
||||
|
||||
target_compile_features(trace_replay_runner PRIVATE cxx_std_17)
|
||||
target_compile_definitions(trace_replay_runner PRIVATE
|
||||
MOBILEGL_APITRACE_RETRACE_MAIN=mobilegl_apitrace_main)
|
||||
|
||||
target_include_directories(trace_replay_runner PRIVATE
|
||||
"${APITRACE_ROOT}/lib/image")
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef exit
|
||||
#pragma push_macro("exit")
|
||||
#undef exit
|
||||
#define MOBILEGL_TRACE_RESTORE_EXIT_MACRO
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef MOBILEGL_TRACE_RESTORE_EXIT_MACRO
|
||||
#pragma pop_macro("exit")
|
||||
#undef MOBILEGL_TRACE_RESTORE_EXIT_MACRO
|
||||
#endif
|
||||
|
||||
struct MobileGLRetraceExit {
|
||||
int status;
|
||||
};
|
||||
|
||||
@@ -22,7 +22,11 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" int main(int argc, char** argv);
|
||||
#ifndef MOBILEGL_APITRACE_RETRACE_MAIN
|
||||
#define MOBILEGL_APITRACE_RETRACE_MAIN main
|
||||
#endif
|
||||
|
||||
extern "C" int MOBILEGL_APITRACE_RETRACE_MAIN(int argc, char** argv);
|
||||
|
||||
namespace mobilegl_trace {
|
||||
namespace {
|
||||
@@ -108,6 +112,7 @@ std::string JsonEscape(const std::string& value) {
|
||||
|
||||
bool LoadMobileGL(const Request& request, std::string& error) {
|
||||
setenv("MOBILEGL_BACKEND_TYPE", request.backend.c_str(), 1);
|
||||
setenv("MOBILEGL_TRACE_LIBRARY", request.mobileGlLibrary.c_str(), 1);
|
||||
|
||||
void* handle = dlopen(request.mobileGlLibrary.c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||
if (handle == nullptr) {
|
||||
@@ -366,7 +371,7 @@ int RunRetraceMain(const Request& request) {
|
||||
tracePath.data(),
|
||||
nullptr,
|
||||
};
|
||||
return main(10, argv);
|
||||
return MOBILEGL_APITRACE_RETRACE_MAIN(10, argv);
|
||||
}
|
||||
|
||||
bool RunRetrace(const Request& request, Result& result) {
|
||||
|
||||
Reference in New Issue
Block a user