Running tests using
tester
To run standard tests, run the following:
tester build- builds the test applicationstester parallel- runs the tests
The built test applications can be found under the following folders:
tests/binariestests/programs- for scripting languages
Note
Most additional options of the tester application are
experimental, and may, or may not currently work!
Real-world testing
CodeTracer is developed as a solution for debugging complex applications, so the simple tests are not enough for testing in real-world scenarios.
For this reason, we have a number of highly complex applications real-world applications/libraries that can be used to test complex usages of CodeTracer.
Note
C/C++/Rust examples are for internal use, since the backend for systems programming languages is yet to be released publicly.
Tip
Though currently unstable, this backend has been proved to work with these applications without many issues. You can check them out yourself as a way to gauge how effective CodeTracer would be in your project.
Note
The custom patches to the C/C++ applications are required because CodeTracer Shell is currently not capable of bootstrapping complex C/C++ projects. Integrations with most of the popular build tools are coming soon!
Noir applications
Coming soon!
UntitledDBusUtils(C++)
The UntitledDBusUtils library is a C++ metaprogramming wrapper on top of the low level D-Bus C API. The code for deserialisation of data has highly complex control flow that is hard to track with a normal debugger when a bug is introduced.
Running steps:
- Clone the library:
git clone https://github.com/metacraft-labs/UntitledDBusUtils.git --recursive - Enter the cloned folder:
- On NixOS, run
nix-shell - On any other distribution, install the following:
- D-Bus
- CMake
- GNU Make
- GCC & G++
- rr
- GDB
- OpenSSL
- On NixOS, run
- Copy
<codetracer directory>/src/native/trace.cinto the root project directory. Documentation - Create a
builddirectory and enter it - Run
cmake .. -DCMAKE_BUILD_TYPE=DEBUG - Compile with
make -j <number of jobs> - Go to your local copy of
codetracer-desktop(make sure you're still in the Nix shell if on NixOS) - Run
ct record <UntitledDBusUtils location>/build/test - Once the process hangs run the following command in another
terminal, in order to feed the application data:
user $ gdbus call --session --dest org.test.Test --object-path /org/test/Test --method org.test.Test.Test --timeout=1 1 2 "test" "(([3,4,5,6],[7,8,9,10]),11,12,([13,14,15,16],[17,18,19,20]))" "test2" - Run
ct replay <UntitledDBusUtils location>/build/test
UntitledImGuiFramework/UImGuiDemo(C++)
The UntitledImGuiFramework is an example of a highly-complex application that also deals with graphics and constant interactions between it, the user, and the underlying operating system.
To test it, we're using the UImGuiDemo example application.
Installation instructions:
- Clone the framework:
git clone https://github.com/MadLadSquad/UntitledImGuiFramework.git --recursive - Enter the cloned folder:
- If on NixOS, run
nix-shell - If on any other distribution, install all dependencies you may need, as listed in the Installation guide
- If on NixOS, run
- Run
user $ ./install.sh - Wait for it to finish
- Add the following line to
Framework/cmake/UImGuiHeader.cmake:add_compile_options(-g3 -O0 -finstrument-functions -fcf-protection=none) - Apply changes similar to this patch to
Framework/cmake/CompileProject.cmake:diff --git a/Framework/cmake/CompileProject.cmake b/Framework/cmake/CompileProject.cmake index f79592a..db6afb3 100644 --- a/Framework/cmake/CompileProject.cmake +++ b/Framework/cmake/CompileProject.cmake @@ -18,7 +18,7 @@ else() endif() add_executable(${APP_TARGET} ${EXECUTABLE_SOURCES}) endif() - +add_library(trace Source/trace.c) include(SetupTargetSettings) # ---------------------------------------------------------------------------------------------------------------------- @@ -38,9 +38,9 @@ elseif (EMSCRIPTEN) endforeach() else () target_link_libraries(UntitledImGuiFramework ${GLFW_LIBRARIES_T} ${GLEW_LIBRARIES_T} ${OPENGL_LIBRARIES_T} pthread - ${YAML_CPP_LIBRARIES_T} ${FREETYPE_LIBRARIES} ${VULKAN_LIBRARIES_T} ${X11_LIBRARIES} dl util) - target_link_libraries(${APP_LIB_TARGET} UntitledImGuiFramework pthread dl ${YAML_CPP_LIBRARIES_T} util) - target_link_libraries(${APP_TARGET} UntitledImGuiFramework ${APP_LIB_TARGET} ${YAML_CPP_LIBRARIES_T} dl util) + ${YAML_CPP_LIBRARIES_T} ${FREETYPE_LIBRARIES} ${VULKAN_LIBRARIES_T} ${X11_LIBRARIES} dl util trace) + target_link_libraries(${APP_LIB_TARGET} UntitledImGuiFramework pthread dl ${YAML_CPP_LIBRARIES_T} util trace) + target_link_libraries(${APP_TARGET} UntitledImGuiFramework ${APP_LIB_TARGET} ${YAML_CPP_LIBRARIES_T} dl util trace) if (APPLE) target_link_libraries(UntitledImGuiFramework "-framework Cocoa" "-framework IOKit" "-framework CoreFoundation" - Go to the
Projectsdirectory and clone the demo application:git clone https://github.com/MadLadSquad/UImGuiDemo - Go to
../UVKBuildTool/buildand run./UVKBuildTool --generate ../../Projects/UImGuiDemo - Go back to
../../Projecs/UImGuiDemo/ - Copy
<codetracer-directory>/src/native/trace.ctoSource/ - Create a
buildfolder and enter it - Run
cmake .. -DCMAKE_BUILD_TYPE_DEBUG - Run
make -j <number of jobs> - Get the path to the CodeTracer executable. If developing locally go
to the CodeTracer source directory and type
which ct - Add the path to the CodeTracer executable to your path
- Run
ct record ./UImGuiDemoand close the application after you're done recording - Replay using
ct replay ./UImGuiDemo