Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drowaudio committed May 20, 2024
1 parent e8fbfd4 commit 1cbe545
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 8 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ Dynamic library to catch run-time safety violations heavily inspired by [RADSan]

## CI/Tests
- [ ] Failures
- [ ] Throwing exceptions
- [ ] Large std::function
- [ ] Atomic 4*ptr size
- [x] Throwing exceptions
- [x] Large std::function
- [x] Atomic 4*ptr size
- [ ] Dynamic loading of a library
- [ ] Passes
- [ ] Atomic double
- [ ] Small std::function
- [ ] Running on CI
- [ ] Tests via CTest (can catch failues)
- [x] Atomic double
- [x] Small std::function
- [x] Running on CI Linux
- [x] Running on CI macOS
- [x] Tests via CTest (can catch failues)

## Packages
- [ ] cpack
Expand Down
1 change: 1 addition & 0 deletions src/lib_rt_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ extern "C" void free(void* ptr)
return real_free(ptr);
}


// //==============================================================================
// // threads
// //==============================================================================
Expand Down
6 changes: 6 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ foreach(file ${test_files})
rt_check
)

if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
target_link_libraries(${test_name}
atomic
)
endif()

target_link_options(${test_name} PRIVATE
"-rdynamic"
)
Expand Down
18 changes: 18 additions & 0 deletions tests/fail_large_atomic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <atomic>
#include <lib_rt_check.h>

struct doubles
{
double d1, d2, d3, d4;
};

int main()
{
std::atomic<doubles> a;
doubles d;

realtime_context rc;
a.store (d);

return 0;
}
2 changes: 1 addition & 1 deletion tests/fail_syscall.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <unistd.h>
#include <sys/syscall.h>
#include <vector>
#include <lib_rt_check.h>


Expand Down
17 changes: 17 additions & 0 deletions tests/fail_throw_exception.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdexcept>
#include <lib_rt_check.h>

int main()
{
realtime_context rc;

try
{
throw (std::runtime_error ("runtime_error"));
}
catch (std::runtime_error)
{
}

return 0;
}
16 changes: 16 additions & 0 deletions tests/pass_nothrow_exception.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdexcept>
#include <lib_rt_check.h>

int main()
{
realtime_context rc;

try
{
}
catch (std::runtime_error)
{
}

return 0;
}
13 changes: 13 additions & 0 deletions tests/pass_small_atomic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <atomic>
#include <lib_rt_check.h>


int main()
{
std::atomic<float> a;

realtime_context rc;
a = 42.0f;

return 0;
}

0 comments on commit 1cbe545

Please sign in to comment.