Skip to content

Commit

Permalink
[RTL_APITEST] Move RtlIntSafe test from kmtest to rtl_apitest
Browse files Browse the repository at this point in the history
  • Loading branch information
tkreuzer committed Oct 18, 2023
1 parent ee7234e commit bd4f060
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions modules/rostests/apitests/ntdll/testlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extern void func_RtlGetUnloadEventTrace(void);
extern void func_RtlHandle(void);
extern void func_RtlImageDirectoryEntryToData(void);
extern void func_RtlImageRvaToVa(void);
extern void func_RtlIntSafe(void);
extern void func_RtlIsNameLegalDOS8Dot3(void);
extern void func_RtlMemoryStream(void);
extern void func_RtlMultipleAllocateHeap(void);
Expand Down Expand Up @@ -176,6 +177,7 @@ const struct test winetest_testlist[] =
{ "RtlHandle", func_RtlHandle },
{ "RtlImageDirectoryEntryToData", func_RtlImageDirectoryEntryToData },
{ "RtlImageRvaToVa", func_RtlImageRvaToVa },
{ "RtlIntSafe", func_RtlIntSafe },
{ "RtlIsNameLegalDOS8Dot3", func_RtlIsNameLegalDOS8Dot3 },
{ "RtlMemoryStream", func_RtlMemoryStream },
{ "RtlMultipleAllocateHeap", func_RtlMultipleAllocateHeap },
Expand Down
2 changes: 1 addition & 1 deletion modules/rostests/apitests/rtl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


list(APPEND SOURCE
# To be filled
RtlIntSafe.c
)

if(ARCH STREQUAL "i386")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* PROGRAMMER: Thomas Faber <[email protected]>
*/

#define KMT_EMULATE_KERNEL
#include <kmt_test.h>
#include <rtltests.h>
#define ENABLE_INTSAFE_SIGNED_FUNCTIONS
#include <ntintsafe.h>

Expand Down Expand Up @@ -76,7 +75,7 @@ START_TEST(RtlIntSafe)

TEST_CONVERSION(Long, LONG, UInt, UINT, uint, 0, 0, STATUS_SUCCESS);
TEST_CONVERSION(Long, LONG, UInt, UINT, uint, 5, 5, STATUS_SUCCESS);
TEST_CONVERSION(Long, LONG, UInt, UINT, uint, LONG_MAX, LONG_MAX, STATUS_SUCCESS);
TEST_CONVERSION(Long, LONG, UInt, UINT, uint, INT_MAX, INT_MAX, STATUS_SUCCESS);
TEST_CONVERSION(Long, LONG, UInt, UINT, uint, -1, (UINT)-1, STATUS_INTEGER_OVERFLOW);
TEST_CONVERSION(Long, LONG, UInt, UINT, uint, LONG_MIN, (UINT)-1, STATUS_INTEGER_OVERFLOW);

Expand Down Expand Up @@ -129,15 +128,15 @@ START_TEST(RtlIntSafe)
TEST_ADD(Int8, INT8, int, INT8_MIN, -1, (INT8)-1, STATUS_INTEGER_OVERFLOW);
TEST_ADD(Int8, INT8, int, INT8_MIN, INT8_MIN, (INT8)-1, STATUS_INTEGER_OVERFLOW);

TEST_ADD(LongLong, LONGLONG, longlong, 0, 0, 0, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, 5, 5, 10, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, 0, 0, (LONGLONG)0, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, 5, 5, (LONGLONG)10, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, 0, LONGLONG_MAX, LONGLONG_MAX, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, 0, LONGLONG_MAX, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX - 1, 1, LONGLONG_MAX, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, 1, (LONGLONG)-1, STATUS_INTEGER_OVERFLOW);
TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, INT8_MAX, (LONGLONG)-1, STATUS_INTEGER_OVERFLOW);
TEST_ADD(LongLong, LONGLONG, longlong, 0, -1, -1, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, -1, 0, -1, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, 0, -1, (LONGLONG)-1, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, -1, 0, (LONGLONG)-1, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, 0, LONGLONG_MIN, LONGLONG_MIN, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MIN, 0, LONGLONG_MIN, STATUS_SUCCESS);
TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, LONGLONG_MIN, (LONGLONG)-1, STATUS_SUCCESS);
Expand Down
3 changes: 3 additions & 0 deletions modules/rostests/apitests/rtl/testlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
#include <apitest.h>

extern void func_RtlCaptureContext(void);
extern void func_RtlIntSafe(void);

const struct test winetest_testlist[] =
{
{ "RtlIntSafe", func_RtlIntSafe },

#ifdef _M_AMD64
{ "RtlCaptureContext", func_RtlCaptureContext },
#endif
Expand Down
2 changes: 1 addition & 1 deletion modules/rostests/kmtests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ list(APPEND COMMON_SOURCE
example/GuardedMemory.c
rtl/RtlAvlTree.c
rtl/RtlException.c
rtl/RtlIntSafe.c
../apitests/rtl/RtlIntSafe.c
rtl/RtlMemory.c
rtl/RtlRegistry.c
rtl/RtlSplayTree.c
Expand Down

0 comments on commit bd4f060

Please sign in to comment.