From 7df454fc9b96944d9cc57f565a1ba1f1373b2f02 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 28 Nov 2007 12:11:51 +0100 Subject: tests: rename test_sysinfo, remove tailing white-spaces Signed-off-by: Karel Zak --- tests/commands.sh.in | 2 +- tests/helpers/Makefile.am | 3 +- tests/helpers/mnt_test_sysinfo.c | 126 --------------------------------------- tests/helpers/test_sysinfo.c | 126 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 129 deletions(-) delete mode 100644 tests/helpers/mnt_test_sysinfo.c create mode 100644 tests/helpers/test_sysinfo.c diff --git a/tests/commands.sh.in b/tests/commands.sh.in index c96a422c..4963f103 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -7,7 +7,7 @@ AWK=@AWK@ TS_TESTUSER=${TS_TESTUSER:-"test"} # helpers -TS_HELPER_SYSINFO="$TS_TOPDIR/helpers/mnt_test_sysinfo" +TS_HELPER_SYSINFO="$TS_TOPDIR/helpers/test_sysinfo" # external commands TS_ECMD_BLKID="@BLKID@" diff --git a/tests/helpers/Makefile.am b/tests/helpers/Makefile.am index 0f28a7f8..7cf7ff4e 100644 --- a/tests/helpers/Makefile.am +++ b/tests/helpers/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/config/include-Makefile.am -noinst_PROGRAMS = mnt_test_sysinfo test_blkdev -mnt_test_sysinfo_SOURCES = mnt_test_sysinfo.c +noinst_PROGRAMS = test_sysinfo test_blkdev test_blkdev_SOURCES = $(top_srcdir)/lib/blkdev.c \ $(top_srcdir)/lib/linux_version.c diff --git a/tests/helpers/mnt_test_sysinfo.c b/tests/helpers/mnt_test_sysinfo.c deleted file mode 100644 index 0e09a35f..00000000 --- a/tests/helpers/mnt_test_sysinfo.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2007 Karel Zak - * - * This file is part of util-linux-ng. - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include - -#include - -typedef struct { - const char *name; - int (*fnc)(void); -} mntHlpfnc; - -int -hlp_wordsize(void) -{ - printf("%d\n", __WORDSIZE); - return 0; -} - -int -hlp_pagesize(void) -{ - printf("%d\n", (int) sysconf(_SC_PAGESIZE)); - return 0; -} - -int -hlp_int_max(void) -{ - printf("%d\n", INT_MAX); - return 0; -} - -int -hlp_uint_max(void) -{ - printf("%u\n", UINT_MAX); - return 0; -} - -int -hlp_long_max(void) -{ - printf("%ld\n", LONG_MAX); - return 0; -} - -int -hlp_ulong_max(void) -{ - printf("%lu\n", ULONG_MAX); - return 0; -} - -int -hlp_ulong_max32(void) -{ -#if __WORDSIZE == 64 - printf("%lu\n", ULONG_MAX >> 32); -#else - printf("%lu\n", ULONG_MAX); -#endif - return 0; -} - -mntHlpfnc hlps[] = -{ - { "WORDSIZE", hlp_wordsize }, - { "pagesize", hlp_pagesize }, - { "INT_MAX", hlp_int_max }, - { "UINT_MAX", hlp_uint_max }, - { "LONG_MAX", hlp_long_max }, - { "ULONG_MAX", hlp_ulong_max }, - { "ULONG_MAX32",hlp_ulong_max32 }, - { NULL, NULL } -}; - -int -main(int argc, char **argv) -{ - int re = 0; - mntHlpfnc *fn; - - if (argc == 1) { - for (fn = hlps; fn->name; fn++) { - printf("%15s: ", fn->name); - re += fn->fnc(); - } - } else { - int i; - - if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) { - printf("%s