summaryrefslogtreecommitdiffstats
path: root/tests/ts/misc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:30 +0000
commitc61e14d3a8412cd50d98aab604e607692c844c8a (patch)
tree4925aca0e6b64c8664ea2f3fdfa99a52dc93d5da /tests/ts/misc
parentAdding upstream version 2.39.3. (diff)
downloadutil-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.tar.xz
util-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.zip
Adding upstream version 2.40.upstream/2.40
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ts/misc')
-rwxr-xr-xtests/ts/misc/boilerplate39
-rwxr-xr-xtests/ts/misc/enosys58
-rwxr-xr-xtests/ts/misc/lsclocks70
-rwxr-xr-xtests/ts/misc/setpgid33
-rwxr-xr-xtests/ts/misc/time_t28
-rwxr-xr-xtests/ts/misc/waitpid4
6 files changed, 230 insertions, 2 deletions
diff --git a/tests/ts/misc/boilerplate b/tests/ts/misc/boilerplate
new file mode 100755
index 0000000..d795ec2
--- /dev/null
+++ b/tests/ts/misc/boilerplate
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de>
+#
+# This file is part of util-linux.
+#
+# 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.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="Documentation/boilerplate"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_HELPER_BOILERPLATE"
+
+ts_init_subtest exec
+
+"$TS_HELPER_BOILERPLATE" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+echo "ret=$?" >> "$TS_OUTPUT"
+
+ts_finalize_subtest
+
+ts_init_subtest help
+
+"$TS_HELPER_BOILERPLATE" --help >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+echo "ret=$?" >> "$TS_OUTPUT"
+
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/misc/enosys b/tests/ts/misc/enosys
new file mode 100755
index 0000000..ae93c63
--- /dev/null
+++ b/tests/ts/misc/enosys
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# Copyright (C) 2022 Thomas Weißschuh <thomas@t-8ch.de>
+#
+# This file is part of util-linux.
+#
+# 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.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="enosys"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_HELPER_ENOSYS"
+ts_check_enosys_syscalls fallocate fsopen execve
+
+ts_init_subtest basic
+
+FALLOCATE_TEST="$TS_HELPER_ENOSYS fallocate"
+
+$FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -s fallocate $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -s fsopen -s fallocate $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -s fallocate -s fsopen $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+
+ts_finalize_subtest
+
+ts_init_subtest exec
+
+FALLOCATE_TEST="$TS_HELPER_ENOSYS exec"
+
+$FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -s execve $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+
+ts_finalize_subtest
+
+ts_init_subtest ioctl
+
+FALLOCATE_TEST="$TS_HELPER_ENOSYS ioctl"
+
+$FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -s ioctl $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -i FIOCLEX $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -i "$("$TS_CMD_ENOSYS" -m | grep FIOCLEX | awk '{ print $1 }')" $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+"$TS_CMD_ENOSYS" -s ioctl -i FIOCLEX $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT"
+
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/misc/lsclocks b/tests/ts/misc/lsclocks
new file mode 100755
index 0000000..71fefaa
--- /dev/null
+++ b/tests/ts/misc/lsclocks
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+# Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de>
+#
+# This file is part of util-linux.
+#
+# 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.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="lsclocks"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_LSCLOCKS"
+ts_check_prog sed
+
+mask_timestamps() {
+ sed 's/[0-9]\+\.[0-9]\+/X.X/g'
+}
+
+NO_DISCOVER="--no-discover-dynamic --no-discover-rtc"
+
+ts_init_subtest basic
+
+"$TS_CMD_LSCLOCKS" $NO_DISCOVER -o TYPE,ID,CLOCK,NAME > "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+
+ts_finalize_subtest
+
+ts_init_subtest time
+
+"$TS_CMD_LSCLOCKS" --time monotonic | mask_timestamps > "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+
+ts_finalize_subtest
+
+ts_init_subtest dynamic
+
+if [ -c /dev/ptp0 ] && [ -r /dev/ptp0 ]; then
+ "$TS_CMD_LSCLOCKS" $NO_DISCOVER --dynamic-clock /dev/ptp0 --output TYPE,ID,CLOCK,NAME \
+ | tail -1 > "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+ ts_finalize_subtest
+else
+ ts_skip_subtest "/dev/ptp0 not usable"
+fi
+
+ts_init_subtest rtc
+
+if [ -c /dev/rtc0 ] && [ -r /dev/rtc0 ]; then
+ "$TS_CMD_LSCLOCKS" $NO_DISCOVER --rtc /dev/rtc0 --output TYPE,ID,CLOCK,NAME \
+ | tail -1 > "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+ ts_finalize_subtest
+else
+ ts_skip_subtest "/dev/rtc0 not usable"
+fi
+
+ts_init_subtest cpu
+
+"$TS_CMD_LSCLOCKS" --cpu 1 --output TYPE,ID,NAME | tail -1 > "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/misc/setpgid b/tests/ts/misc/setpgid
new file mode 100755
index 0000000..40c4754
--- /dev/null
+++ b/tests/ts/misc/setpgid
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# 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.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="setpgid"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_SETPGID"
+
+$TS_CMD_SETPGID echo "success" >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+# qemu-user always reports '0' for the pgid field which prevents the test from
+# working so we skip it.
+ts_skip_qemu_user
+
+PGID1="$(awk '{print $5}' /proc/self/stat)"
+PGID2="$($TS_CMD_SETPGID awk '{print $5}' /proc/self/stat)"
+test ! "$PGID1" = "$PGID2" && echo "not equal" >> $TS_OUTPUT
+
+ts_finalize
diff --git a/tests/ts/misc/time_t b/tests/ts/misc/time_t
new file mode 100755
index 0000000..b0ced51
--- /dev/null
+++ b/tests/ts/misc/time_t
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de>
+#
+# This file is part of util-linux.
+#
+# 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.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="time_t size"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_HELPER_SYSINFO"
+[ -n "$UL_ALLOW_32BIT_TIME" ] && ts_skip "32bit time allowed"
+
+"$TS_HELPER_SYSINFO" 'sz(time_t)' >> "$TS_OUTPUT"
+
+ts_finalize
diff --git a/tests/ts/misc/waitpid b/tests/ts/misc/waitpid
index ae5ab6f..904222c 100755
--- a/tests/ts/misc/waitpid
+++ b/tests/ts/misc/waitpid
@@ -24,7 +24,7 @@ ts_check_test_command "$TS_CMD_WAITPID"
ts_init_subtest normal
-(sleep 0.2; echo 1 >> "$TS_OUTPUT") &
+(sleep 0.5; echo 1 >> "$TS_OUTPUT") &
BG1="$!"
(sleep 0.1; echo 2 >> "$TS_OUTPUT") &
@@ -44,7 +44,7 @@ echo $? >> "$TS_OUTPUT"
ts_finalize_subtest
ts_init_subtest exited
-"$TS_CMD_WAITPID" -e 2147483647 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
+"$TS_CMD_WAITPID" -v -e 2147483647 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
echo $? >> "$TS_ERRLOG"
ts_finalize_subtest