summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/vsprintf
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
commit4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch)
treeb48831a898906734f8884d08b6e18f1144ee2b82 /src/pal/tests/palsuite/c_runtime/vsprintf
parentdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff)
downloadcoreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.gz
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.bz2
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.zip
Imported Upstream version 1.0.0.9910upstream/1.0.0.9910
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/vsprintf')
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt1
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.cpp6
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.cpp6
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp6
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp2
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.cpp43
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h30
27 files changed, 49 insertions, 150 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt
index cafb9536b0..8fe1cb60ac 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/CMakeLists.txt
@@ -14,7 +14,6 @@ add_subdirectory(test19)
add_subdirectory(test2)
add_subdirectory(test3)
add_subdirectory(test4)
-add_subdirectory(test5)
add_subdirectory(test6)
add_subdirectory(test7)
add_subdirectory(test8)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt
index 6861157c1b..34d8ad9f9b 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test1
add_dependencies(paltest_vsprintf_test1 coreclrpal)
target_link_libraries(paltest_vsprintf_test1
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.cpp
index 2007fefc5b..18c8c0ea1a 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.cpp
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test1/test1.cpp
@@ -29,7 +29,7 @@ int __cdecl main(int argc, char *argv[])
return(FAIL);
}
- testvsp(buf, "hello world");
+ testvsp(buf, _countof(buf), "hello world");
if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0)
{
@@ -37,8 +37,8 @@ int __cdecl main(int argc, char *argv[])
checkstr, 256, buf);
}
- testvsp(buf, "xxxxxxxxxxxxxxxxx");
- ret = testvsp(buf, "hello world");
+ testvsp(buf, _countof(buf), "xxxxxxxxxxxxxxxxx");
+ ret = testvsp(buf, _countof(buf), "hello world");
if (ret != strlen(checkstr))
{
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt
index 6f535a5098..3b0477a2c6 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test10/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test10
add_dependencies(paltest_vsprintf_test10 coreclrpal)
target_link_libraries(paltest_vsprintf_test10
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt
index 3fa628f77d..723fa6b7f2 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test11/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test11
add_dependencies(paltest_vsprintf_test11 coreclrpal)
target_link_libraries(paltest_vsprintf_test11
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt
index f34f76abc5..b58d47edd7 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test12/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test12
add_dependencies(paltest_vsprintf_test12 coreclrpal)
target_link_libraries(paltest_vsprintf_test12
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt
index df23693f10..33ea479374 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test13/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test13
add_dependencies(paltest_vsprintf_test13 coreclrpal)
target_link_libraries(paltest_vsprintf_test13
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt
index 394b5ab97c..b1a078498b 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test14/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test14
add_dependencies(paltest_vsprintf_test14 coreclrpal)
target_link_libraries(paltest_vsprintf_test14
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt
index 4793b45663..b6642eddba 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test15/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test15
add_dependencies(paltest_vsprintf_test15 coreclrpal)
target_link_libraries(paltest_vsprintf_test15
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt
index 6a0a52ddf7..c587798c62 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test16/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test16
add_dependencies(paltest_vsprintf_test16 coreclrpal)
target_link_libraries(paltest_vsprintf_test16
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt
index 4e220dab77..edc5b334d1 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test17/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test17
add_dependencies(paltest_vsprintf_test17 coreclrpal)
target_link_libraries(paltest_vsprintf_test17
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt
index 4dd68c2987..c9f20d5d52 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test18/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test18
add_dependencies(paltest_vsprintf_test18 coreclrpal)
target_link_libraries(paltest_vsprintf_test18
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt
index 3156a59a15..886f867de0 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test19/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test19
add_dependencies(paltest_vsprintf_test19 coreclrpal)
target_link_libraries(paltest_vsprintf_test19
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt
index 210224f0f1..c9fca91c19 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test2
add_dependencies(paltest_vsprintf_test2 coreclrpal)
target_link_libraries(paltest_vsprintf_test2
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.cpp
index fbd4b41068..fc9163e976 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.cpp
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test2/test2.cpp
@@ -36,6 +36,12 @@ int __cdecl main(int argc, char *argv[])
DoStrTest("foo %5.2s", "bar", "foo ba");
DoStrTest("foo %-5s", "bar", "foo bar ");
DoStrTest("foo %05s", "bar", "foo 00bar");
+ DoStrTest("foo %s", NULL, "foo (null)");
+ DoStrTest("foo %hs", NULL, "foo (null)");
+ DoWStrTest("foo %ls", NULL, "foo (null)");
+ DoWStrTest("foo %ws", NULL, "foo (null)");
+ DoStrTest("foo %Ls", NULL, "foo (null)");
+ DoStrTest("foo %I64s", NULL, "foo (null)");
PAL_Terminate();
return PASS;
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt
index 5581051f9f..7e45989685 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test3
add_dependencies(paltest_vsprintf_test3 coreclrpal)
target_link_libraries(paltest_vsprintf_test3
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp
index 742370ebe9..4656bf3a92 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test3/test3.cpp
@@ -37,6 +37,12 @@ int __cdecl main(int argc, char *argv[])
DoWStrTest("foo %5.2S", convert("bar"), "foo ba");
DoWStrTest("foo %-5S", convert("bar"), "foo bar ");
DoWStrTest("foo %05S", convert("bar"), "foo 00bar");
+ DoWStrTest("foo %S", NULL, "foo (null)");
+ DoStrTest("foo %hS", NULL, "foo (null)");
+ DoWStrTest("foo %lS", NULL, "foo (null)");
+ DoWStrTest("foo %wS", NULL, "foo (null)");
+ DoWStrTest("foo %LS", NULL, "foo (null)");
+ DoWStrTest("foo %I64S", NULL, "foo (null)");
PAL_Terminate();
return PASS;
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt
index 88817fcffb..9571f586c3 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test4
add_dependencies(paltest_vsprintf_test4 coreclrpal)
target_link_libraries(paltest_vsprintf_test4
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp
index dc43a9e2c7..e052d8ee68 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp
@@ -31,7 +31,7 @@ int __cdecl main(int argc, char *argv[])
/*
** Run only on 64 bit platforms
*/
-#if defined(BIT64) && defined(PLATFORM_UNIX)
+#if defined(BIT64)
Trace("Testing for 64 Bit Platforms \n");
DoPointerTest("%p", NULL, "NULL", "0000000000000000");
DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456");
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt
deleted file mode 100644
index 6d14bf76bf..0000000000
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test5.cpp
-)
-
-add_executable(paltest_vsprintf_test5
- ${SOURCES}
-)
-
-add_dependencies(paltest_vsprintf_test5 coreclrpal)
-
-target_link_libraries(paltest_vsprintf_test5
- pthread
- m
- coreclrpal
-)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.cpp
deleted file mode 100644
index e630d8863b..0000000000
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/test5.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=====================================================================
-**
-** Source: test5.c
-**
-** Purpose: Test #5 for the vsprintf function.
-**
-**
-**===================================================================*/
-
-#include <palsuite.h>
-#include "../vsprintf.h"
-
-/*
- * Notes: memcmp is used, as is strlen.
- */
-
-
-int __cdecl main(int argc, char *argv[])
-{
- if (PAL_Initialize(argc, argv) != 0)
- {
- return(FAIL);
- }
-
- DoTest("foo %n bar", 4, "foo bar");
- DoTest("foo %#n bar", 4, "foo bar");
- DoTest("foo % n bar", 4, "foo bar");
- DoTest("foo %+n bar", 4, "foo bar");
- DoTest("foo %-n bar", 4, "foo bar");
- DoTest("foo %0n bar", 4, "foo bar");
- DoShortTest("foo %hn bar", 4, "foo bar");
- DoTest("foo %ln bar", 4, "foo bar");
- DoTest("foo %Ln bar", 4, "foo bar");
- DoTest("foo %I64n bar", 4, "foo bar");
- DoTest("foo %20.3n bar", 4, "foo bar");
-
- PAL_Terminate();
- return PASS;
-}
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vsprintf/test5/testinfo.dat
deleted file mode 100644
index 81748f88b9..0000000000
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test5/testinfo.dat
+++ /dev/null
@@ -1,14 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-Version = 1.0
-Section = C Runtime
-Function = vsprintf
-Name = Positive Test for vsprintf
-TYPE = DEFAULT
-EXE1 = test5
-Description
-= Tests the PAL implementation of the vsprintf function.
-= Tests vsprintf with the count specifier.
-= This test is modeled after _snprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt
index 606fe3b965..7dc7e1d621 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test6/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test6
add_dependencies(paltest_vsprintf_test6 coreclrpal)
target_link_libraries(paltest_vsprintf_test6
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt
index 2dee276968..7b05fbeb51 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test7/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test7
add_dependencies(paltest_vsprintf_test7 coreclrpal)
target_link_libraries(paltest_vsprintf_test7
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt
index 8dac76fc3a..36231aa954 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test8/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test8
add_dependencies(paltest_vsprintf_test8 coreclrpal)
target_link_libraries(paltest_vsprintf_test8
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt
index 95f0faad87..ca74546b0e 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test9/CMakeLists.txt
@@ -13,7 +13,5 @@ add_executable(paltest_vsprintf_test9
add_dependencies(paltest_vsprintf_test9 coreclrpal)
target_link_libraries(paltest_vsprintf_test9
- pthread
- m
- coreclrpal
+ ${COMMON_TEST_LIBRARIES}
)
diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h b/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h
index 7b04a777ca..22bf53e53b 100644
--- a/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h
+++ b/src/pal/tests/palsuite/c_runtime/vsprintf/vsprintf.h
@@ -14,13 +14,13 @@
#define __VSPRINTF_H__
/* These functions leaks memory like crazy. C'est la vie. */
-int testvsp(char* buf, const char* format, ...)
+int testvsp(char* buf, size_t buffSize, const char* format, ...)
{
int retVal;
va_list arglist;
va_start(arglist, format);
- retVal = vsprintf(buf, format, arglist);
+ retVal = _vsnprintf_s(buf, buffSize, _TRUNCATE, format, arglist);
va_end(arglist);
return (retVal);
@@ -30,7 +30,7 @@ void DoStrTest(const char *formatstr, char* param, const char *checkstr)
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, param);
+ testvsp(buf, _countof(buf), formatstr, param);
if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
{
Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n"
@@ -43,7 +43,7 @@ void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr)
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, param);
+ testvsp(buf, _countof(buf), formatstr, param);
if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
{
Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n"
@@ -57,7 +57,7 @@ void DoCharTest(const char *formatstr, char param, const char *checkstr)
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, param);
+ testvsp(buf, _countof(buf), formatstr, param);
if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
{
Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n"
@@ -70,7 +70,7 @@ void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr)
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, param);
+ testvsp(buf, _countof(buf), formatstr, param);
if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
{
Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n"
@@ -83,7 +83,7 @@ void DoNumTest(const char *formatstr, int value, const char *checkstr)
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, value);
+ testvsp(buf, _countof(buf), formatstr, value);
if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
{
Fail("ERROR: failed to insert %#x into \"%s\"\n"
@@ -96,7 +96,7 @@ void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *c
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, value);
+ testvsp(buf, _countof(buf), formatstr, value);
if (memcmp(buf, checkstr, strlen(buf) + 1) != 0)
{
Fail("ERROR: failed to insert %s into \"%s\"\n"
@@ -109,7 +109,7 @@ void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, ch
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, value);
+ testvsp(buf, _countof(buf), formatstr, value);
if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
{
@@ -124,7 +124,7 @@ void DoArgumentPrecTest(const char *formatstr, int precision, void *param,
{
char buf[256];
- testvsp(buf, formatstr, precision, param);
+ testvsp(buf, _countof(buf), formatstr, precision, param);
if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
{
@@ -140,7 +140,7 @@ void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param
{
char buf[256];
- testvsp(buf, formatstr, precision, param);
+ testvsp(buf, _countof(buf), formatstr, precision, param);
if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
{
@@ -155,7 +155,7 @@ void DoPointerTest(const char *formatstr, void* param, char* paramstr,
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, param);
+ testvsp(buf, _countof(buf), formatstr, param);
if (memcmp(buf, checkstr1, strlen(checkstr1) + 1))
{
Fail("ERROR: failed to insert %s into \"%s\"\n"
@@ -169,7 +169,7 @@ void DoI64DoubleTest(const char *formatstr, INT64 value, char *valuestr,
{
char buf[256] = { 0 };
- testvsp(buf, formatstr, value);
+ testvsp(buf, _countof(buf), formatstr, value);
if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0)
{
Fail("ERROR: failed to insert %s into \"%s\"\n"
@@ -183,7 +183,7 @@ void DoTest(const char *formatstr, int param, const char *checkstr)
char buf[256] = { 0 };
int n = -1;
- testvsp(buf, formatstr, &n);
+ testvsp(buf, _countof(buf), formatstr, &n);
if (n != param)
{
@@ -201,7 +201,7 @@ void DoShortTest(const char *formatstr, int param, const char *checkstr)
char buf[256] = { 0 };
short int n = -1;
- testvsp(buf, formatstr, &n);
+ testvsp(buf, _countof(buf), formatstr, &n);
if (n != param)
{