# HG changeset patch # User Josef 'Jeff' Sipek # Date 1586534227 14400 # Node ID 59316ed46006f6bc315070083f763a4453169fd7 # Parent 32d261e8b47f740e1b0d566550d759754dec5b03 tests: add xhostname test It only prints the hostname, but even that is useful enough. Signed-off-by: Josef 'Jeff' Sipek diff -r 32d261e8b47f -r 59316ed46006 tests/.hgignore --- a/tests/.hgignore Fri Mar 15 11:42:40 2019 -0400 +++ b/tests/.hgignore Fri Apr 10 11:57:07 2020 -0400 @@ -14,6 +14,7 @@ test_endian test_errno test_hexdump +test_hostname test_is_p2 test_list test_mutex-destroy-held diff -r 32d261e8b47f -r 59316ed46006 tests/CMakeLists.txt --- a/tests/CMakeLists.txt Fri Mar 15 11:42:40 2019 -0400 +++ b/tests/CMakeLists.txt Fri Apr 10 11:57:07 2020 -0400 @@ -40,6 +40,7 @@ build_test_bin_and_run(endian) build_test_bin_and_run(errno) build_test_bin_and_run(hexdump) +build_test_bin_and_run(hostname) build_test_bin_and_run(is_p2) build_test_bin_and_run(list) build_test_bin_and_run(mutex-destroy-memcpy) diff -r 32d261e8b47f -r 59316ed46006 tests/test_hostname.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_hostname.c Fri Apr 10 11:57:07 2020 -0400 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020 Josef 'Jeff' Sipek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include + +#include "test.c" + +void test(void) +{ + fprintf(stderr, "hostname = %s\n", xgethostname()); +}