diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-02-10 20:35:12 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-02-10 20:35:12 +0900 |
commit | 4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch) | |
tree | b48831a898906734f8884d08b6e18f1144ee2b82 /src/pal/tests/palsuite/c_runtime/vswprintf | |
parent | db20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff) | |
download | coreclr-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/vswprintf')
28 files changed, 45 insertions, 182 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt index cafb9536b0..8fe1cb60ac 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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/vswprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt index 1d6233744a..6b23e50345 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test1 add_dependencies(paltest_vswprintf_test1 coreclrpal) target_link_libraries(paltest_vswprintf_test1 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.cpp index d386ce104f..968f8a5c69 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.cpp @@ -27,7 +27,7 @@ int __cdecl main(int argc, char *argv[]) return(FAIL); checkstr = convert("hello world"); - testvswp(buf, checkstr); + testvswp(buf, _countof(buf), checkstr); if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0) { diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt index e5301427eb..4e6171ec61 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test10 add_dependencies(paltest_vswprintf_test10 coreclrpal) target_link_libraries(paltest_vswprintf_test10 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt index 1cfadb9300..9e37b63b1f 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test11 add_dependencies(paltest_vswprintf_test11 coreclrpal) target_link_libraries(paltest_vswprintf_test11 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt index f5a582a970..2747ebf468 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test12 add_dependencies(paltest_vswprintf_test12 coreclrpal) target_link_libraries(paltest_vswprintf_test12 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt index 5571d7336f..4c96d3fecc 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test13 add_dependencies(paltest_vswprintf_test13 coreclrpal) target_link_libraries(paltest_vswprintf_test13 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt index 234029ead4..62a9efc660 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test14 add_dependencies(paltest_vswprintf_test14 coreclrpal) target_link_libraries(paltest_vswprintf_test14 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt index b705268bc7..2142c53044 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test15 add_dependencies(paltest_vswprintf_test15 coreclrpal) target_link_libraries(paltest_vswprintf_test15 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt index da296bcf32..44fd1145b9 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test16 add_dependencies(paltest_vswprintf_test16 coreclrpal) target_link_libraries(paltest_vswprintf_test16 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt index 02234c1672..2d1d8cd85e 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test17 add_dependencies(paltest_vswprintf_test17 coreclrpal) target_link_libraries(paltest_vswprintf_test17 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt index 0c0e5b566b..d561baef83 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test18 add_dependencies(paltest_vswprintf_test18 coreclrpal) target_link_libraries(paltest_vswprintf_test18 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt index 066db8ab84..e2e6001cce 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test19 add_dependencies(paltest_vswprintf_test19 coreclrpal) target_link_libraries(paltest_vswprintf_test19 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.cpp index 1d1c5656b2..12f2b7ba99 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.cpp +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.cpp @@ -24,7 +24,7 @@ void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param, { WCHAR buf[256]; - testvswp(buf, formatstr, precision, param); + testvswp(buf, _countof(buf), formatstr, precision, param); if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) { @@ -43,7 +43,7 @@ void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param, { WCHAR buf[256]; - testvswp(buf, formatstr, precision, param); + testvswp(buf, _countof(buf), formatstr, precision, param); if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) { diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt index abfceca9e2..b1dee38b4a 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test2 add_dependencies(paltest_vswprintf_test2 coreclrpal) target_link_libraries(paltest_vswprintf_test2 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.cpp index 491d99f0cf..a7b1b3a336 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.cpp +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.cpp @@ -34,6 +34,12 @@ int __cdecl main(int argc, char *argv[]) DoWStrTest(convert("foo %5.2s"), convert("bar"), convert("foo ba")); DoWStrTest(convert("foo %-5s"), convert("bar"), convert("foo bar ")); DoWStrTest(convert("foo %05s"), convert("bar"), convert("foo 00bar")); + DoWStrTest(convert("foo %s"), NULL, convert("foo (null)")); + DoStrTest(convert("foo %hs"), NULL, convert("foo (null)")); + DoWStrTest(convert("foo %ls"), NULL, convert("foo (null)")); + DoWStrTest(convert("foo %ws"), NULL, convert("foo (null)")); + DoWStrTest(convert("foo %Ls"), NULL, convert("foo (null)")); + DoWStrTest(convert("foo %I64s"), NULL, convert("foo (null)")); PAL_Terminate(); return PASS; diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt index 7f4798dbc5..4d49a107b8 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test3 add_dependencies(paltest_vswprintf_test3 coreclrpal) target_link_libraries(paltest_vswprintf_test3 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.cpp index 1eb0b65ebe..40c7d2afcf 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.cpp +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.cpp @@ -34,6 +34,12 @@ int __cdecl main(int argc, char *argv[]) DoStrTest(convert("foo %5.2S"), "bar", convert("foo ba")); DoStrTest(convert("foo %-5S"), "bar", convert("foo bar ")); DoStrTest(convert("foo %05S"), "bar", convert("foo 00bar")); + DoStrTest(convert("foo %S"), NULL, convert("foo (null)")); + DoStrTest(convert("foo %hS"), NULL, convert("foo (null)")); + DoWStrTest(convert("foo %lS"), NULL, convert("foo (null)")); + DoWStrTest(convert("foo %wS"), NULL, convert("foo (null)")); + DoStrTest(convert("foo %LS"), NULL, convert("foo (null)")); + DoStrTest(convert("foo %I64S"), NULL, convert("foo (null)")); PAL_Terminate(); return PASS; diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt index 05701ac179..d38b9cd824 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test4 add_dependencies(paltest_vswprintf_test4 coreclrpal) target_link_libraries(paltest_vswprintf_test4 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp index 5c9047b5a7..c54fe6aabb 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp @@ -21,7 +21,7 @@ static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr, { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, param); + testvswp(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) { @@ -39,7 +39,7 @@ static void DoI64DoubleTest(WCHAR *formatstr, INT64 value, WCHAR *valuestr, { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, value); + testvswp(buf, _countof(buf), formatstr, value); if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) { Fail("ERROR: failed to insert %s into \"%s\"\n" @@ -62,7 +62,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(convert("%p"), NULL, convert("NULL"), convert("0000000000000000")); DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"), diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt deleted file mode 100644 index 888ce27d22..0000000000 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test5 - ${SOURCES} -) - -add_dependencies(paltest_vswprintf_test5 coreclrpal) - -target_link_libraries(paltest_vswprintf_test5 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.cpp deleted file mode 100644 index 42146c8be7..0000000000 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.cpp +++ /dev/null @@ -1,79 +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 vswprintf function. -** -** -**===================================================================*/ - -#include <palsuite.h> -#include "../vswprintf.h" - -/* memcmp is used to verify the results, so this test is dependent on it. */ -/* ditto with wcslen */ - -static void DoTest(WCHAR *formatstr, int param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - int n = -1; - - testvswp(buf, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", - param, n); - } - - if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", - convertC(checkstr), convertC(buf)); - } -} - -static void DoShortTest(WCHAR *formatstr, int param, WCHAR *checkstr) -{ - WCHAR buf[256] = { 0 }; - short int n = -1; - - testvswp(buf, formatstr, &n); - - if (n != param) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", - param, n); - } - - if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) - { - Fail("ERROR: Expected \"%s\" got \"%s\".\n", - convertC(checkstr), convertC(buf)); - } -} - -int __cdecl main(int argc, char *argv[]) -{ - if (PAL_Initialize(argc, argv) != 0) - return(FAIL); - - DoTest(convert("foo %n bar"), 4, convert("foo bar")); - DoTest(convert("foo %#n bar"), 4, convert("foo bar")); - DoTest(convert("foo % n bar"), 4, convert("foo bar")); - DoTest(convert("foo %+n bar"), 4, convert("foo bar")); - DoTest(convert("foo %-n bar"), 4, convert("foo bar")); - DoTest(convert("foo %0n bar"), 4, convert("foo bar")); - DoShortTest(convert("foo %hn bar"), 4, convert("foo bar")); - DoTest(convert("foo %ln bar"), 4, convert("foo bar")); - DoTest(convert("foo %Ln bar"), 4, convert("foo bar")); - DoTest(convert("foo %I64n bar"), 4, convert("foo bar")); - DoTest(convert("foo %20.3n bar"), 4, convert("foo bar")); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/testinfo.dat deleted file mode 100644 index 17ca0fd33b..0000000000 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf -Name = Positive Test for vswprintf -TYPE = DEFAULT -EXE1 = test5 -Description -= Tests the PAL implementation of the vswprintf function. -= Tests vswprintf with the count specifier. -= This test is modeled after _snwprintf. diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt index bfbb17ccef..0caa96ed78 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test6 add_dependencies(paltest_vswprintf_test6 coreclrpal) target_link_libraries(paltest_vswprintf_test6 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt index 8b980586bc..3244576813 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test7 add_dependencies(paltest_vswprintf_test7 coreclrpal) target_link_libraries(paltest_vswprintf_test7 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt index 07ba473844..f972c00067 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test8 add_dependencies(paltest_vswprintf_test8 coreclrpal) target_link_libraries(paltest_vswprintf_test8 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt index 11c77787e9..ee9c04d7ee 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt @@ -13,7 +13,5 @@ add_executable(paltest_vswprintf_test9 add_dependencies(paltest_vswprintf_test9 coreclrpal) target_link_libraries(paltest_vswprintf_test9 - pthread - m - coreclrpal + ${COMMON_TEST_LIBRARIES} ) diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h index 37a379212e..36895d207f 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h @@ -15,13 +15,13 @@ #define __vswprintf_H__ /* These functions leaks memory like crazy. C'est la vie. */ -int testvswp(wchar_t* buf, const wchar_t* format, ...) +int testvswp(wchar_t* buf, size_t buffSize, const wchar_t* format, ...) { int retVal = 0; va_list arglist; va_start(arglist, format); - retVal = vswprintf(buf, format, arglist); + retVal = _vsnwprintf_s(buf, buffSize, _TRUNCATE, format, arglist); va_end(arglist); return( retVal); @@ -31,7 +31,7 @@ void DoWStrTest(const WCHAR *formatstr, WCHAR *param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, param); + testvswp(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0) { @@ -46,7 +46,7 @@ void DoStrTest(const WCHAR *formatstr, char *param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, param); + testvswp(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0) { @@ -61,7 +61,7 @@ void DoCharTest(const WCHAR *formatstr, char param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, param); + testvswp(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) { Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" @@ -75,7 +75,7 @@ void DoWCharTest(const WCHAR *formatstr, WCHAR param, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, param); + testvswp(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) { Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" @@ -89,7 +89,7 @@ void DoNumTest(const WCHAR *formatstr, int value, const WCHAR *checkstr) { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, value); + testvswp(buf, _countof(buf), formatstr, value); if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0) { Fail("ERROR: failed to insert %#x into \"%s\"\n" @@ -102,7 +102,7 @@ void DoI64NumTest(const WCHAR *formatstr, INT64 value, char *valuestr, const WCH { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, value); + testvswp(buf, _countof(buf), formatstr, value); if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0) { Fail("ERROR: failed to insert %s into \"%s\"\n" @@ -115,7 +115,7 @@ void DoDoubleTest(const WCHAR *formatstr, double value, const WCHAR *checkstr1, { WCHAR buf[256] = { 0 }; - testvswp(buf, formatstr, value); + testvswp(buf, _countof(buf), formatstr, value); if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 && memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0) { |