1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
. "$HARNESS" cmp
sysname() {
cat /proc/sys/kernel/ostype
}
hostname() {
cat /proc/sys/kernel/hostname
}
release() {
cat /proc/sys/kernel/osrelease
}
version() {
cat /proc/sys/kernel/version
}
should_print_name() {
if ! [ -e /proc/version ]
then
printf "SKIP(requires Linux) "
return
fi
[ "$(uname)" = "$(sysname)" ] && [ "$(uname -s)" = "$(sysname)" ]
}
should_print_release() {
if ! [ -e /proc/version ]
then
printf "SKIP(requires Linux) "
return
fi
[ "$(uname -r)" = "$(release)" ]
}
should_print_hostname() {
if ! [ -e /proc/version ]
then
printf "SKIP(requires Linux) "
return
fi
[ "$(uname -n)" = "$(hostname)" ]
}
should_print_version() {
if ! [ -e /proc/version ]
then
printf "SKIP(requires Linux) "
return
fi
[ "$(uname -v)" = "$(version)" ]
}
should_print_arch() {
if [ -z "${ARCH:-}" ]
then
echo 'SKIP($ARCH undefined) '
return
fi
[ "$(uname -m)" = "$ARCH" ]
}
should_print_everything() {
if [ -z "${ARCH:-}" ] || ! [ -e /proc/version ]
then
echo 'SKIP($ARCH undefined and/or non-Linux host) '
return
fi
# Additional implementation-defined symbols may be written; all such
# symbols shall be written at the end of the line of output before the
# <newline>.
case "$(uname -a)" in
"$(sysname) $(hostname) $(release) $(version) $ARCH"*)
return
;;
*)
return 1
;;
esac
}
should_handle_ddash uname
runtests \
should_handle_ddash \
should_print_name \
should_print_release \
should_print_hostname \
should_print_version \
should_print_arch \
should_print_everything