diff options
Diffstat (limited to 'src/pal/tests/palsuite/pal_specific/PAL_get_stdout')
4 files changed, 88 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/CMakeLists.txt new file mode 100644 index 0000000000..f6aa0cb2d9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) + diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/CMakeLists.txt b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/CMakeLists.txt new file mode 100644 index 0000000000..865dd52f16 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + PAL_get_stdout.c +) + +add_executable(paltest_pal_get_stdout_test1 + ${SOURCES} +) + +add_dependencies(paltest_pal_get_stdout_test1 coreclrpal) + +target_link_libraries(paltest_pal_get_stdout_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.c b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.c new file mode 100644 index 0000000000..ebfee47ae9 --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/PAL_get_stdout.c @@ -0,0 +1,52 @@ +// 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: pal_get_stdout.c +** +** Purpose: Positive test the PAL_get_stdout API. +** Call PAL_get_stdout to retrieve the PAL standard output +** stream pointer. +** This test case should be run manually and automatically. +** + +** +**============================================================*/ +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + int err; + FILE *pPAL_stdout = NULL; + const char *pMsg = "\nThis is a PAL_get_stdout test output message, " + "not an error message!\n"; + + /*Initialize the PAL environment*/ + err = PAL_Initialize(argc, argv); + if(0 != err) + { + return FAIL; + } + + /*retrieve the PAL output stream pointer*/ + pPAL_stdout = PAL_get_stdout(); + if(NULL == pPAL_stdout) + { + Fail("\nFailed to call PAL_get_stdout API to retrieve the " + "standard PAL output stream pointer, error code=%u\n", + GetLastError()); + } + + /*output a test message through PAL standard output stream*/ + err = fputs(pMsg, pPAL_stdout); + if(EOF == err) + { + Fail("\nFailed to call fputs to output message to PAL stdandard " + "output stream, error code=%u\n", GetLastError()); + } + + PAL_Terminate(); + return PASS; +} diff --git a/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/testinfo.dat b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/testinfo.dat new file mode 100644 index 0000000000..ed370981aa --- /dev/null +++ b/src/pal/tests/palsuite/pal_specific/PAL_get_stdout/test1/testinfo.dat @@ -0,0 +1,13 @@ +# 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 = PAL_Specific +Function = PAL_get_stdout +Name = Positive test PAL_get_stdout to retrieve PAL standard output stream pointer +TYPE = DEFAULT +EXE1 = pal_get_stdout +Description +=Test the PAL_get_stdout to retrieve the PAL standard output stream pointer +=This test case will be run both manually and automatically |