2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4 PATH
=/sbin
:/bin
:/usr
/sbin
:/usr
/bin
7 LOOKS_LIKE_DEBIAN
=$
(source /etc
/os-release
&& [[ "$ID" = "debian" ||
"$ID_LIKE" = "debian" ]] && echo yes || true
)
8 LOOKS_LIKE_ARCH
=$
(source /etc
/os-release
&& [[ "$ID" = "arch" ]] && echo yes || true
)
9 LOOKS_LIKE_SUSE
=$
(source /etc
/os-release
&& [[ "$ID_LIKE" = "suse" ]] && echo yes || true
)
10 KERNEL_VER
=${KERNEL_VER-$(uname -r)}
11 KERNEL_MODS
="/lib/modules/$KERNEL_VER/"
12 QEMU_TIMEOUT
="${QEMU_TIMEOUT:-infinity}"
13 NSPAWN_TIMEOUT
="${NSPAWN_TIMEOUT:-infinity}"
14 TIMED_OUT
= # will be 1 after run_* if *_TIMEOUT is set and test timed out
15 [[ "$LOOKS_LIKE_SUSE" ]] && FSTYPE
="${FSTYPE:-btrfs}" || FSTYPE
="${FSTYPE:-ext4}"
16 UNIFIED_CGROUP_HIERARCHY
="${UNIFIED_CGROUP_HIERARCHY:-default}"
17 EFI_MOUNT
="$(bootctl -p 2>/dev/null || echo /boot)"
19 if ! ROOTLIBDIR
=$
(pkg-config
--variable=systemdutildir systemd
); then
20 echo "WARNING! Cannot determine rootlibdir from pkg-config, assuming /usr/lib/systemd" >&2
21 ROOTLIBDIR
=/usr
/lib
/systemd
24 BASICTOOLS
="test sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false"
25 DEBUGTOOLS
="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find"
27 STATEDIR
="${BUILD_DIR:-.}/test/$(basename $(dirname $(realpath $0)))"
28 STATEFILE
="$STATEDIR/.testdir"
29 TESTLOG
="$STATEDIR/test.log"
31 function find_qemu_bin
() {
32 # SUSE and Red Hat call the binary qemu-kvm
33 # Debian and Gentoo call it kvm
34 [ "$QEMU_BIN" ] || QEMU_BIN
=$
(which -a kvm qemu-kvm
2>/dev
/null |
grep '^/' -m1)
36 [ "$ARCH" ] || ARCH
=$
(uname
-m)
39 # QEMU's own build system calls it qemu-system-x86_64
40 [ "$QEMU_BIN" ] || QEMU_BIN
=$
(which -a qemu-system-x86_64
2>/dev
/null |
grep '^/' -m1)
43 # new i386 version of QEMU
44 [ "$QEMU_BIN" ] || QEMU_BIN
=$
(which -a qemu-system-i386
2>/dev
/null |
grep '^/' -m1)
46 # i386 version of QEMU
47 [ "$QEMU_BIN" ] || QEMU_BIN
=$
(which -a qemu
2>/dev
/null |
grep '^/' -m1)
50 [ "$QEMU_BIN" ] || QEMU_BIN
=$
(which -a qemu-system-
$ARCH 2>/dev
/null |
grep '^/' -m1)
54 if [ ! -e "$QEMU_BIN" ]; then
55 echo "Could not find a suitable QEMU binary" >&2
60 # Return 0 if QEMU did run (then you must check the result state/logs for actual
61 # success), or 1 if QEMU is not available.
63 if [ -f /etc
/machine-id
]; then
64 read MACHINE_ID
< /etc
/machine-id
65 [ -z "$INITRD" ] && [ -e "$EFI_MOUNT/$MACHINE_ID/$KERNEL_VER/initrd" ] \
66 && INITRD
="$EFI_MOUNT/$MACHINE_ID/$KERNEL_VER/initrd"
67 [ -z "$KERNEL_BIN" ] && [ -e "$EFI_MOUNT/$MACHINE_ID/$KERNEL_VER/linux" ] \
68 && KERNEL_BIN
="$EFI_MOUNT/$MACHINE_ID/$KERNEL_VER/linux"
71 if [[ ! "$KERNEL_BIN" ]]; then
72 if [[ "$LOOKS_LIKE_ARCH" ]]; then
73 KERNEL_BIN
=/boot
/vmlinuz-linux
75 KERNEL_BIN
=/boot
/vmlinuz-
$KERNEL_VER
79 default_fedora_initrd
=/boot
/initramfs-
${KERNEL_VER}.img
80 default_debian_initrd
=/boot
/initrd.img-
${KERNEL_VER}
81 default_arch_initrd
=/boot
/initramfs-linux.img
82 default_suse_initrd
=/boot
/initrd-
${KERNEL_VER}
83 if [[ ! "$INITRD" ]]; then
84 if [[ -e "$default_fedora_initrd" ]]; then
85 INITRD
="$default_fedora_initrd"
86 elif [[ "$LOOKS_LIKE_DEBIAN" && -e "$default_debian_initrd" ]]; then
87 INITRD
="$default_debian_initrd"
88 elif [[ "$LOOKS_LIKE_ARCH" && -e "$default_arch_initrd" ]]; then
89 INITRD
="$default_arch_initrd"
90 elif [[ "$LOOKS_LIKE_SUSE" && -e "$default_suse_initrd" ]]; then
91 INITRD
="$default_suse_initrd"
95 [ "$QEMU_SMP" ] || QEMU_SMP
=1
97 find_qemu_bin ||
return 1
100 if [[ "$UNIFIED_CGROUP_HIERARCHY" = "yes" ]]; then
101 _cgroup_args
="systemd.unified_cgroup_hierarchy=yes"
102 elif [[ "$UNIFIED_CGROUP_HIERARCHY" = "no" ]]; then
103 _cgroup_args
="systemd.unified_cgroup_hierarchy=no systemd.legacy_systemd_cgroup_controller=yes"
104 elif [[ "$UNIFIED_CGROUP_HIERARCHY" = "hybrid" ]]; then
105 _cgroup_args
="systemd.unified_cgroup_hierarchy=no systemd.legacy_systemd_cgroup_controller=no"
106 elif [[ "$UNIFIED_CGROUP_HIERARCHY" != "default" ]]; then
107 dfatal
"Unknown UNIFIED_CGROUP_HIERARCHY. Got $UNIFIED_CGROUP_HIERARCHY, expected [yes|no|hybrid|default]"
111 if [[ "$LOOKS_LIKE_SUSE" ]]; then
112 PARAMS
+="rd.hostonly=0"
117 KERNEL_APPEND
="$PARAMS \
121 init=$ROOTLIBDIR/systemd \
128 QEMU_OPTIONS
="-smp $QEMU_SMP \
132 -kernel $KERNEL_BIN \
133 -drive format=raw,cache=unsafe,file=${TESTDIR}/rootdisk.img \
136 if [[ "$INITRD" && "$SKIP_INITRD" != "yes" ]]; then
137 QEMU_OPTIONS
="$QEMU_OPTIONS -initrd $INITRD"
140 if [ -c /dev
/kvm
]; then
141 QEMU_OPTIONS
="$QEMU_OPTIONS -machine accel=kvm -enable-kvm -cpu host"
144 if [[ "$QEMU_TIMEOUT" != "infinity" ]]; then
145 QEMU_BIN
="timeout --foreground $QEMU_TIMEOUT $QEMU_BIN"
147 (set -x; $QEMU_BIN $QEMU_OPTIONS -append "$KERNEL_APPEND")
149 if [ "$rc" = 124 ] && [ "$QEMU_TIMEOUT" != "infinity" ]; then
150 derror
"test timed out after $QEMU_TIMEOUT s"
153 [ "$rc" != 0 ] && derror
"QEMU failed with exit code $rc"
158 # Return 0 if nspawn did run (then you must check the result state/logs for actual
159 # success), or 1 if nspawn is not available.
161 [[ -d /run
/systemd
/system
]] ||
return 1
163 local _nspawn_cmd
="$BUILD_DIR/systemd-nspawn --register=no --kill-signal=SIGKILL --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND"
164 if [[ "$NSPAWN_TIMEOUT" != "infinity" ]]; then
165 _nspawn_cmd
="timeout --foreground $NSPAWN_TIMEOUT $_nspawn_cmd"
168 if [[ "$UNIFIED_CGROUP_HIERARCHY" = "hybrid" ]]; then
169 dwarn
"nspawn doesn't support UNIFIED_CGROUP_HIERARCHY=hybrid, skipping"
171 elif [[ "$UNIFIED_CGROUP_HIERARCHY" = "yes" ||
"$UNIFIED_CGROUP_HIERARCHY" = "no" ]]; then
172 _nspawn_cmd
="env UNIFIED_CGROUP_HIERARCHY=$UNIFIED_CGROUP_HIERARCHY $_nspawn_cmd"
173 elif [[ "$UNIFIED_CGROUP_HIERARCHY" = "default" ]]; then
174 _nspawn_cmd
="env --unset=UNIFIED_CGROUP_HIERARCHY $_nspawn_cmd"
176 dfatal
"Unknown UNIFIED_CGROUP_HIERARCHY. Got $UNIFIED_CGROUP_HIERARCHY, expected [yes|no|hybrid|default]"
180 (set -x; $_nspawn_cmd)
182 if [ "$rc" = 124 ] && [ "$NSPAWN_TIMEOUT" != "infinity" ]; then
183 derror
"test timed out after $NSPAWN_TIMEOUT s"
186 [ "$rc" != 0 ] && derror
"nspawn failed with exit code $rc"
191 setup_basic_environment
() {
192 # create the basic filesystem layout
196 install_missing_libraries
214 generate_module_dependencies
218 # don't forget KERNEL_APPEND='... selinux=1 ...'
219 if [[ "$SETUP_SELINUX" != "yes" ]]; then
220 ddebug
"Don't setup SELinux"
223 ddebug
"Setup SELinux"
224 local _conf_dir
=/etc
/selinux
225 local _fixfiles_tools
="bash uname cat sort uniq awk grep egrep head expr find rm secon setfiles"
227 rm -rf $initdir/$_conf_dir
228 if ! cp -ar $_conf_dir $initdir/$_conf_dir; then
229 dfatal
"Failed to copy $_conf_dir"
233 cat <<EOF >$initdir/etc/systemd/system/autorelabel.service
235 Description=Relabel all filesystems
236 DefaultDependencies=no
237 Requires=local-fs.target
238 Conflicts=shutdown.target
239 After=local-fs.target
240 Before=sysinit.target shutdown.target
241 ConditionSecurity=selinux
242 ConditionPathExists=|/.autorelabel
245 ExecStart=/bin/sh -x -c 'echo 0 >/sys/fs/selinux/enforce && fixfiles -f -F relabel && rm /.autorelabel && systemctl --force reboot'
251 touch $initdir/.autorelabel
252 mkdir
-p $initdir/etc
/systemd
/system
/basic.target.wants
253 ln -fs autorelabel.service
$initdir/etc
/systemd
/system
/basic.target.wants
/autorelabel.service
255 dracut_install
$_fixfiles_tools
256 dracut_install fixfiles
257 dracut_install sestatus
261 if ! type -p valgrind
; then
262 dfatal
"Failed to install valgrind"
266 local _valgrind_bins
=$
(strace
-e execve valgrind
/bin
/true
2>&1 >/dev
/null | perl
-lne 'print $1 if /^execve\("([^"]+)"/')
267 dracut_install
$_valgrind_bins
269 local _valgrind_libs
=$
(LD_DEBUG
=files valgrind
/bin
/true
2>&1 >/dev
/null | perl
-lne 'print $1 if m{calling init: (/.*vgpreload_.*)}')
270 dracut_install
$_valgrind_libs
272 local _valgrind_dbg_and_supp
=$
(
273 strace
-e open valgrind
/bin
/true
2>&1 >/dev
/null |
274 perl
-lne 'if (my ($fname) = /^open\("([^"]+).*= (?!-)\d+/) { print $fname if $fname =~ /debug|\.supp$/ }'
276 dracut_install
$_valgrind_dbg_and_supp
279 create_valgrind_wrapper
() {
280 local _valgrind_wrapper
=$initdir/$ROOTLIBDIR/systemd-under-valgrind
281 ddebug
"Create $_valgrind_wrapper"
282 cat >$_valgrind_wrapper <<EOF
285 mount -t proc proc /proc
286 exec valgrind --leak-check=full --log-file=/valgrind.out $ROOTLIBDIR/systemd "\$@"
288 chmod 0755 $_valgrind_wrapper
291 create_strace_wrapper
() {
292 local _strace_wrapper
=$initdir/$ROOTLIBDIR/systemd-under-strace
293 ddebug
"Create $_strace_wrapper"
294 cat >$_strace_wrapper <<EOF
297 exec strace -D -o /strace.out $ROOTLIBDIR/systemd "\$@"
299 chmod 0755 $_strace_wrapper
303 dracut_install
/sbin
/fsck
*
304 dracut_install
-o /bin
/fsck
*
306 # fskc.reiserfs calls reiserfsck. so, install it
307 dracut_install
-o reiserfsck
311 instmods dm_crypt
=crypto
312 type -P dmeventd
>/dev
/null
&& dracut_install dmeventd
313 inst_libdir_file
"libdevmapper-event.so*"
314 if [[ "$LOOKS_LIKE_DEBIAN" ]]; then
315 # dmsetup installs 55-dm and 60-persistent-storage-dm on Debian/Ubuntu
316 # see https://anonscm.debian.org/cgit/pkg-lvm/lvm2.git/tree/debian/patches/0007-udev.patch
317 inst_rules
55-dm.rules
60-persistent-storage-dm.rules
319 inst_rules
10-dm.rules
13-dm-disk.rules
95-dm-notify.rules
324 # install compiled files
325 local _ninja_bin
=$
(type -P ninja ||
type -P ninja-build
)
326 if [[ -z "$_ninja_bin" ]]; then
327 dfatal
"ninja was not found"
330 (set -x; DESTDIR
=$initdir "$_ninja_bin" -C $BUILD_DIR install)
331 # remove unneeded documentation
332 rm -fr $initdir/usr
/share
/{man
,doc
}
333 # we strip binaries since debug symbols increase binaries size a lot
334 # and it could fill the available space
337 [[ "$LOOKS_LIKE_SUSE" ]] && setup_suse
339 # enable debug logging in PID1
340 echo LogLevel
=debug
>> $initdir/etc
/systemd
/system.conf
345 objdump
-p "$_bin" 2>/dev
/null |
awk "/R(UN)?PATH/ { print \"$initdir\" \$2 }" |
paste -sd :
348 install_missing_libraries
() {
349 # install possible missing libraries
350 for i
in $initdir{,/usr
}/{sbin
,bin
}/* $initdir{,/usr
}/lib
/systemd
/*; do
351 LD_LIBRARY_PATH
=$
(get_ldpath
$i) inst_libs
$i
355 create_empty_image
() {
356 rm -f "$TESTDIR/rootdisk.img"
357 # Create the blank file to use as a root filesystem
358 dd if=/dev
/null of
="$TESTDIR/rootdisk.img" bs
=1M seek
=400
359 LOOPDEV
=$
(losetup
--show -P -f $TESTDIR/rootdisk.img
)
360 [ -b "$LOOPDEV" ] ||
return 1
361 echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
362 sfdisk
"$LOOPDEV" <<EOF
367 local _label
="-L systemd"
368 # mkfs.reiserfs doesn't know -L. so, use --label instead
369 [[ "$FSTYPE" == "reiserfs" ]] && _label
="--label systemd"
370 if ! mkfs
-t "${FSTYPE}" ${_label} "${LOOPDEV}p1" -q; then
371 dfatal
"Failed to mkfs -t ${FSTYPE}"
376 check_result_nspawn
() {
378 [[ -e $TESTDIR/nspawn-root
/testok
]] && ret
=0
379 [[ -f $TESTDIR/nspawn-root
/failed
]] && cp -a $TESTDIR/nspawn-root
/failed
$TESTDIR
380 cp -a $TESTDIR/nspawn-root
/var
/log
/journal
$TESTDIR
381 [[ -f $TESTDIR/failed
]] && cat $TESTDIR/failed
382 ls -l $TESTDIR/journal
/*/*.journal
383 test -s $TESTDIR/failed
&& ret
=$
(($ret+1))
384 [ -n "$TIMED_OUT" ] && ret
=$
(($ret+1))
388 # can be overridden in specific test
389 check_result_qemu
() {
391 mkdir
-p $TESTDIR/root
392 mount
${LOOPDEV}p1
$TESTDIR/root
393 [[ -e $TESTDIR/root
/testok
]] && ret
=0
394 [[ -f $TESTDIR/root
/failed
]] && cp -a $TESTDIR/root
/failed
$TESTDIR
395 cp -a $TESTDIR/root
/var
/log
/journal
$TESTDIR
397 [[ -f $TESTDIR/failed
]] && cat $TESTDIR/failed
398 ls -l $TESTDIR/journal
/*/*.journal
399 test -s $TESTDIR/failed
&& ret
=$
(($ret+1))
400 [ -n "$TIMED_OUT" ] && ret
=$
(($ret+1))
405 if [[ "$STRIP_BINARIES" = "no" ]]; then
406 ddebug
"Don't strip binaries"
409 ddebug
"Strip binaries"
410 find "$initdir" -executable -not -path '*/lib/modules/*.ko' -type f |
xargs strip
--strip-unneeded | ddebug
414 mkdir
-p $initdir/etc
/rc.d
415 cat >$initdir/etc
/rc.d
/rc.
local <<EOF
419 chmod 0755 $initdir/etc
/rc.d
/rc.
local
423 ddebug
"install any Execs from the service files"
425 export PKG_CONFIG_PATH
=$BUILD_DIR/src
/core
/
426 systemdsystemunitdir
=$
(pkg-config
--variable=systemdsystemunitdir systemd
)
427 systemduserunitdir
=$
(pkg-config
--variable=systemduserunitdir systemd
)
428 egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/{$systemdsystemunitdir,$systemduserunitdir}/*.service \
430 i
=${i##Exec*=}; i=${i##[@+\!-]}; i=${i##\!}
431 # some {rc,halt}.local scripts and programs are okay to not exist, the rest should
432 inst
$i ||
[ "${i%.local}" != "$i" ] ||
[ "${i%systemd-update-done}" != "$i" ]
437 generate_module_dependencies
() {
438 if [[ -d $initdir/lib
/modules
/$KERNEL_VER ]] && \
439 ! depmod
-a -b "$initdir" $KERNEL_VER; then
440 dfatal
"\"depmod -a $KERNEL_VER\" failed."
445 install_depmod_files
() {
446 inst
/lib
/modules
/$KERNEL_VER/modules.order
447 inst
/lib
/modules
/$KERNEL_VER/modules.
builtin
451 # install plymouth, if found... else remove plymouth service files
452 # if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
453 # PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
454 # /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
455 # dracut_install plymouth plymouthd
457 rm -f $initdir/{usr
/lib
,etc
}/systemd
/system
/plymouth
* $initdir/{usr
/lib
,etc
}/systemd
/system
/*/plymouth
*
461 install_ld_so_conf
() {
462 cp -a /etc
/ld.so.conf
* $initdir/etc
463 ldconfig
-r "$initdir"
466 install_config_files
() {
467 inst
/etc
/sysconfig
/init || true
473 inst
/etc
/nsswitch.conf
474 inst
/etc
/pam.conf || true
475 inst
/etc
/securetty || true
478 # we want an empty environment
479 > $initdir/etc
/environment
480 > $initdir/etc
/machine-id
482 echo systemd-testsuite
> $initdir/etc
/hostname
484 if [[ "$LOOKS_LIKE_SUSE" ]]; then
485 ROOTMOUNT
="/dev/sda1 / ${FSTYPE} rw 0 1"
487 ROOTMOUNT
="LABEL=systemd / ${FSTYPE} rw 0 1"
490 cat >$initdir/etc
/fstab
<<EOF
495 install_basic_tools
() {
496 [[ $BASICTOOLS ]] && dracut_install
$BASICTOOLS
497 dracut_install
-o sushell
498 # in Debian ldconfig is just a shell script wrapper around ldconfig.real
499 dracut_install
-o ldconfig.real
502 install_debug_tools
() {
503 [[ $DEBUGTOOLS ]] && dracut_install
$DEBUGTOOLS
507 # install libnss_files for login
508 NSS_LIBS
=$
(LD_DEBUG
=files getent passwd
2>&1 >/dev
/null |
sed -n '/calling init: .*libnss_/ {s!^.* /!/!; p}')
509 dracut_install
$NSS_LIBS
513 inst
$ROOTLIBDIR/system
/dbus.socket
514 inst
$ROOTLIBDIR/system
/dbus.service
517 /etc
/dbus-1
/usr
/share
/dbus-1
-xtype f \
518 |
while read file; do
525 if [[ "$LOOKS_LIKE_DEBIAN" ]] && type -p dpkg-architecture
&>/dev
/null
; then
526 find "/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/security" -xtype f
528 find /lib
*/security
-xtype f
530 find /etc
/pam.d
/etc
/security
-xtype f
531 ) |
while read file; do
535 # pam_unix depends on unix_chkpwd.
536 # see http://www.linux-pam.org/Linux-PAM-html/sag-pam_unix.html
537 dracut_install
-o unix_chkpwd
539 [[ "$LOOKS_LIKE_DEBIAN" ]] &&
540 cp /etc
/pam.d
/systemd-user
$initdir/etc
/pam.d
/
542 # set empty root password for easy debugging
543 sed -i 's/^root:x:/root::/' $initdir/etc
/passwd
548 /usr
/lib
/kbd
/keymaps
/include
/* \
549 /usr
/lib
/kbd
/keymaps
/i386
/include
/* \
550 /usr
/lib
/kbd
/keymaps
/i386
/qwerty
/us.
*; do
551 [[ -f $i ]] ||
continue
558 /usr
/lib
/kbd
/consolefonts
/eurlatgr
* \
559 /usr
/lib
/kbd
/consolefonts
/latarcyrheb-sun16
*; do
560 [[ -f $i ]] ||
continue
566 for _terminfodir
in /lib
/terminfo
/etc
/terminfo
/usr
/share
/terminfo
; do
567 [ -f ${_terminfodir}/l
/linux
] && break
569 dracut_install
-o ${_terminfodir}/l
/linux
573 cp $TEST_BASE_DIR/testsuite.target
$initdir/etc
/systemd
/system
/
574 cp $TEST_BASE_DIR/end.service
$initdir/etc
/systemd
/system
/
576 mkdir
-p $initdir/etc
/systemd
/system
/testsuite.target.wants
577 ln -fs $TEST_BASE_DIR/testsuite.service
$initdir/etc
/systemd
/system
/testsuite.target.wants
/testsuite.service
578 ln -fs $TEST_BASE_DIR/end.service
$initdir/etc
/systemd
/system
/testsuite.target.wants
/end.service
580 # make the testsuite the default target
581 ln -fs testsuite.target
$initdir/etc
/systemd
/system
/default.target
584 setup_nspawn_root
() {
585 rm -fr $TESTDIR/nspawn-root
586 ddebug
"cp -ar $initdir $TESTDIR/nspawn-root"
587 cp -ar $initdir $TESTDIR/nspawn-root
588 # we don't mount in the nspawn root
589 rm -f $TESTDIR/nspawn-root
/etc
/fstab
593 mkdir
-p $initdir/run
594 mkdir
-p $initdir/etc
/systemd
/system
595 mkdir
-p $initdir/var
/log
/journal
597 for d
in usr
/bin usr
/sbin bin etc lib
"$libdir" sbin tmp usr var var
/log dev proc sys sysroot root run run
/lock run
/initramfs
; do
598 if [ -L "/$d" ]; then
605 ln -sfn /run
"$initdir/var/run"
606 ln -sfn /run
/lock
"$initdir/var/lock"
611 local _so_regex
='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
614 LC_ALL
=C ldd
"$_bin" 2>/dev
/null |
while read _line
; do
615 [[ $_line = 'not a dynamic executable' ]] && break
617 if [[ $_line =~
$_so_regex ]]; then
618 _file
=${BASH_REMATCH[1]}
619 [[ -e ${initdir}/$_file ]] && continue
620 inst_library
"$_file"
624 if [[ $_line =~ not\ found
]]; then
625 dfatal
"Missing a shared library required by $_bin."
626 dfatal
"Run \"ldd $_bin\" to find out what it is."
628 dfatal
"dracut cannot create an initrd."
635 [[ -e $STATEFILE ]] && .
$STATEFILE
636 if [[ -z "$TESTDIR" ]] ||
[[ ! -d "$TESTDIR" ]]; then
637 TESTDIR
=$
(mktemp
--tmpdir=/var
/tmp
-d -t systemd-test.XXXXXX
)
638 echo "TESTDIR=\"$TESTDIR\"" > $STATEFILE
644 initdir
=$TESTDIR/root
648 ## @brief Converts numeric logging level to the first letter of level name.
650 # @param lvl Numeric logging level in range from 1 to 6.
651 # @retval 1 if @a lvl is out of range.
652 # @retval 0 if @a lvl is correct.
653 # @result Echoes first letter of level name.
666 ## @brief Internal helper function for _do_dlog()
668 # @param lvl Numeric logging level.
669 # @param msg Message.
670 # @retval 0 It's always returned, even if logging failed.
672 # @note This function is not supposed to be called manually. Please use
673 # dtrace(), ddebug(), or others instead which wrap this one.
675 # This function calls _do_dlog() either with parameter msg, or if
676 # none is given, it will read standard input and will use every line as
680 # dwarn "This is a warning"
681 # echo "This is a warning" | dwarn
685 [ -z "$LOG_LEVEL" ] && return 0
686 [ $1 -le $LOG_LEVEL ] ||
return 0
687 local lvl
="$1"; shift
688 local lvlc
=$
(_lvl2char
"$lvl") ||
return 0
690 if [ $# -ge 1 ]; then
694 echo "$lvlc: " "$line"
699 ## @brief Logs message at TRACE level (6)
701 # @param msg Message.
702 # @retval 0 It's always returned, even if logging failed.
706 [ -n "$debug" ] && set -x ||
:
709 ## @brief Logs message at DEBUG level (5)
711 # @param msg Message.
712 # @retval 0 It's always returned, even if logging failed.
716 # [ -n "$debug" ] && set -x || :
719 ## @brief Logs message at INFO level (4)
721 # @param msg Message.
722 # @retval 0 It's always returned, even if logging failed.
726 [ -n "$debug" ] && set -x ||
:
729 ## @brief Logs message at WARN level (3)
731 # @param msg Message.
732 # @retval 0 It's always returned, even if logging failed.
736 [ -n "$debug" ] && set -x ||
:
739 ## @brief Logs message at ERROR level (2)
741 # @param msg Message.
742 # @retval 0 It's always returned, even if logging failed.
746 # [ -n "$debug" ] && set -x || :
749 ## @brief Logs message at FATAL level (1)
751 # @param msg Message.
752 # @retval 0 It's always returned, even if logging failed.
756 [ -n "$debug" ] && set -x ||
:
760 # Generic substring function. If $2 is in $1, return 0.
761 strstr
() { [ "${1#*$2*}" != "$1" ]; }
763 # normalize_path <path>
764 # Prints the normalized path, where it removes any duplicated
765 # and trailing slashes.
767 # $ normalize_path ///test/test//
771 set -- "${1//+(\/)//}"
776 # convert_abs_rel <from> <to>
777 # Prints the relative path, when creating a symlink to <to> from <from>.
779 # $ convert_abs_rel /usr/bin/test /bin/test-2
781 # $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
783 local __current __absolute __abssize __cursize __newpath
786 set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
788 # corner case #1 - self looping link
789 [[ "$1" == "$2" ]] && { echo "${1##*/}"; return; }
791 # corner case #2 - own dir link
792 [[ "${1%/*}" == "$2" ]] && { echo "."; return; }
794 IFS
="/" __current
=($1)
795 IFS
="/" __absolute
=($2)
797 __abssize
=${#__absolute[@]}
798 __cursize
=${#__current[@]}
800 while [[ ${__absolute[__level]} == ${__current[__level]} ]]
803 if (( __level
> __abssize || __level
> __cursize
))
809 for ((__i
= __level
; __i
< __cursize-1
; __i
++))
813 __newpath
=$__newpath"/"
815 __newpath
=$__newpath".."
818 for ((__i
= __level
; __i
< __abssize
; __i
++))
820 if [[ -n $__newpath ]]
822 __newpath
=$__newpath"/"
824 __newpath
=$__newpath${__absolute[__i]}
831 # Install a directory, keeping symlinks as on the original system.
832 # Example: if /lib points to /lib64 on the host, "inst_dir /lib/file"
833 # will create ${initdir}/lib64, ${initdir}/lib64/file,
834 # and a symlink ${initdir}/lib -> lib64.
836 [[ -e ${initdir}/"$1" ]] && return 0 # already there
838 local _dir
="$1" _part
="${1%/*}" _file
839 while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}/${_part}" ]]; do
844 # iterate over parent directories
845 for _file
in $_dir; do
846 [[ -e "${initdir}/$_file" ]] && continue
847 if [[ -L $_file ]]; then
848 inst_symlink
"$_file"
851 mkdir
-m 0755 -p "${initdir}/$_file" ||
return 1
852 [[ -e "$_file" ]] && chmod --reference="$_file" "${initdir}/$_file"
853 chmod u
+w
"${initdir}/$_file"
858 # $1 = file to copy to ramdisk
859 # $2 (optional) Name for the file on the ramdisk
860 # Location of the image dir is assumed to be $initdir
861 # We never overwrite the target if it exists.
863 [[ -f "$1" ]] ||
return 1
864 strstr
"$1" "/" ||
return 1
866 local _src
=$1 target
="${2:-$1}"
867 if ! [[ -d ${initdir}/$target ]]; then
868 [[ -e ${initdir}/$target ]] && return 0
869 [[ -L ${initdir}/$target ]] && return 0
870 [[ -d "${initdir}/${target%/*}" ]] || inst_dir "${target%/*}"
872 # install checksum files also
873 if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
874 inst
"${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
876 ddebug
"Installing $_src"
877 cp --sparse=always
-pfL "$_src" "${initdir}/$target"
880 # find symlinks linked to given library file
882 # Function searches for symlinks by stripping version numbers appended to
883 # library filename, checks if it points to the same target and finally
884 # prints the list of symlinks to stdout.
887 # rev_lib_symlinks libfoo.so.8.1
888 # output: libfoo.so.8 libfoo.so
889 # (Only if libfoo.so.8 and libfoo.so exists on host system.)
891 [[ ! $1 ]] && return 0
893 local fn
="$1" orig
="$(readlink -f "$1")" links
=''
895 [[ ${fn} =~ .
*\.so\..
* ]] ||
return 1
897 until [[ ${fn##*.} == so
]]; do
899 [[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}"
905 # Same as above, but specialized to handle dynamic libraries.
906 # It handles making symlinks according to how the original library
909 local _src="$1" _dest=${2:-$1} _lib _reallib _symlink
910 strstr "$1" "/" || return 1
911 [[ -e $initdir/$_dest ]] && return 0
912 if [[ -L $_src ]]; then
913 # install checksum files also
914 if [[ -e "${_src%/*}/.
${_src##*/}.hmac
" ]]; then
915 inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac
"
917 _reallib=$(readlink -f "$_src")
918 inst_simple "$_reallib" "$_reallib"
919 inst_dir "${_dest%/*}"
920 [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
921 ln -sfn $
(convert_abs_rel
"${_dest}" "${_reallib}") "${initdir}/${_dest}"
923 inst_simple
"$_src" "$_dest"
926 # Create additional symlinks. See rev_symlinks description.
927 for _symlink
in $
(rev_lib_symlinks
$_src) $
(rev_lib_symlinks
$_reallib); do
928 [[ -e $initdir/$_symlink ]] ||
{
929 ddebug
"Creating extra symlink: $_symlink"
930 inst_symlink
$_symlink
935 # find a binary. If we were not passed the full path directly,
936 # search in the usual places to find the binary.
938 if [[ -z ${1##/*} ]]; then
939 if [[ -x $1 ]] ||
{ strstr
"$1" ".so" && ldd
$1 &>/dev
/null
; }; then
948 # Same as above, but specialized to install binary executables.
949 # Install binary executable, and all shared library dependencies, if any.
952 _bin
=$
(find_binary
"$1") ||
return 1
954 [[ -e $initdir/$_target ]] && return 0
955 [[ -L $_bin ]] && inst_symlink
$_bin $_target && return 0
957 local _so_regex
='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
959 LC_ALL
=C ldd
"$_bin" 2>/dev
/null |
while read _line
; do
960 [[ $_line = 'not a dynamic executable' ]] && break
962 if [[ $_line =~
$_so_regex ]]; then
963 _file
=${BASH_REMATCH[1]}
964 [[ -e ${initdir}/$_file ]] && continue
965 inst_library
"$_file"
969 if [[ $_line =~ not\ found
]]; then
970 dfatal
"Missing a shared library required by $_bin."
971 dfatal
"Run \"ldd $_bin\" to find out what it is."
973 dfatal
"dracut cannot create an initrd."
977 inst_simple
"$_bin" "$_target"
980 # same as above, except for shell scripts.
981 # If your shell script does not start with shebang, it is not a shell script.
984 _bin
=$
(find_binary
"$1") ||
return 1
986 local _line _shebang_regex
987 read -r -n 80 _line
<"$_bin"
988 # If debug is set, clean unprintable chars to prevent messing up the term
989 [[ $debug ]] && _line
=$
(echo -n "$_line" |
tr -c -d '[:print:][:space:]')
990 _shebang_regex
='(#! *)(/[^ ]+).*'
991 [[ $_line =~
$_shebang_regex ]] ||
return 1
992 inst
"${BASH_REMATCH[2]}" && inst_simple
"$_bin" "$@"
995 # same as above, but specialized for symlinks
997 local _src
=$1 _target
=${2:-$1} _realsrc
998 strstr
"$1" "/" ||
return 1
999 [[ -L $1 ]] ||
return 1
1000 [[ -L $initdir/$_target ]] && return 0
1001 _realsrc
=$
(readlink
-f "$_src")
1002 if ! [[ -e $initdir/$_realsrc ]]; then
1003 if [[ -d $_realsrc ]]; then
1004 inst_dir
"$_realsrc"
1009 [[ ! -e $initdir/${_target%/*} ]] && inst_dir
"${_target%/*}"
1010 [[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
1011 ln -sfn $
(convert_abs_rel
"${_target}" "${_realsrc}") "$initdir/$_target"
1014 # attempt to install any programs specified in a udev rule
1015 inst_rule_programs
() {
1018 if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then
1019 for _prog
in $
(grep -E 'PROGRAM==?"[^ "]+' "$1" |
sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do
1020 if [ -x /lib
/udev
/$_prog ]; then
1021 _bin
=/lib
/udev
/$_prog
1023 _bin
=$
(find_binary
"$_prog") ||
{
1024 dinfo
"Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
1029 #dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
1030 dracut_install
"$_bin"
1035 # udev rules always get installed in the same place, so
1036 # create a function to install them to make life simpler.
1038 local _target
=/etc
/udev
/rules.d _rule _found
1040 inst_dir
"/lib/udev/rules.d"
1042 for _rule
in "$@"; do
1043 if [ "${rule#/}" = "$rule" ]; then
1044 for r
in /lib
/udev
/rules.d
/etc
/udev
/rules.d
; do
1045 if [[ -f $r/$_rule ]]; then
1047 inst_simple
"$_found"
1048 inst_rule_programs
"$_found"
1052 for r
in '' .
/ $dracutbasedir/rules.d
/; do
1053 if [[ -f ${r}$_rule ]]; then
1055 inst_simple
"$_found" "$_target/${_found##*/}"
1056 inst_rule_programs
"$_found"
1059 [[ $_found ]] || dinfo
"Skipping udev rule: $_rule"
1063 # general purpose installation function
1064 # Same args as above.
1070 2) [[ ! $initdir && -d $2 ]] && export initdir
=$2
1071 [[ $initdir = $2 ]] && set $1;;
1072 3) [[ -z $initdir ]] && export initdir
=$2
1074 *) dfatal
"inst only takes 1 or 2 or 3 arguments"
1077 for _x
in inst_symlink inst_script inst_binary inst_simple
; do
1078 $_x "$@" && return 0
1083 # install any of listed files
1085 # If first argument is '-d' and second some destination path, first accessible
1086 # source is installed into this path, otherwise it will installed in the same
1087 # path as source. If none of listed files was installed, function return 1.
1088 # On first successful installation it returns with 0 status.
1092 # inst_any -d /bin/foo /bin/bar /bin/baz
1094 # Lets assume that /bin/baz exists, so it will be installed as /bin/foo in
1099 [[ $1 = '-d' ]] && to
="$2" && shift 2
1102 if [[ -e $f ]]; then
1103 [[ $to ]] && inst
"$f" "$to" && return 0
1104 inst
"$f" && return 0
1111 # dracut_install [-o ] <file> [<file> ... ]
1112 # Install <file> to the initramfs image
1113 # -o optionally install the <file> and don't fail, if it is not there
1116 if [[ $1 = '-o' ]]; then
1120 while (($# > 0)); do
1121 if ! inst
"$1" ; then
1122 if [[ $_optional = yes ]]; then
1123 dinfo
"Skipping program $1 as it cannot be found and is" \
1124 "flagged to be optional"
1126 dfatal
"Failed to install $1"
1134 # Install a single kernel module along with any firmware it may require.
1135 # $1 = full path to kernel module to install
1136 install_kmod_with_fw
() {
1137 # no need to go further if the module is already installed
1139 [[ -e "${initdir}/lib/modules/$KERNEL_VER/${1##*/lib/modules/$KERNEL_VER/}" ]] \
1142 [[ -e "$initdir/.kernelmodseen/${1##*/}" ]] && return 0
1144 if [[ $omit_drivers ]]; then
1145 local _kmod
=${1##*/}
1148 if [[ "$_kmod" =~
$omit_drivers ]]; then
1149 dinfo
"Omitting driver $_kmod"
1152 if [[ "${1##*/lib/modules/$KERNEL_VER/}" =~
$omit_drivers ]]; then
1153 dinfo
"Omitting driver $_kmod"
1158 [ -d "$initdir/.kernelmodseen" ] && \
1159 > "$initdir/.kernelmodseen/${1##*/}"
1161 inst_simple
"$1" "/lib/modules/$KERNEL_VER/${1##*/lib/modules/$KERNEL_VER/}" \
1164 local _modname
=${1##*/} _fwdir _found _fw
1165 _modname
=${_modname%.ko*}
1166 for _fw
in $
(modinfo
-k $KERNEL_VER -F firmware
$1 2>/dev
/null
); do
1168 for _fwdir
in $fw_dir; do
1169 if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
1170 inst_simple
"$_fwdir/$_fw" "/lib/firmware/$_fw"
1174 if [[ $_found != yes ]]; then
1175 if ! grep -qe "\<${_modname//-/_}\>" /proc
/modules
; then
1176 dinfo
"Possible missing firmware \"${_fw}\" for kernel module" \
1177 "\"${_modname}.ko\""
1179 dwarn
"Possible missing firmware \"${_fw}\" for kernel module" \
1180 "\"${_modname}.ko\""
1187 # Do something with all the dependencies of a kernel module.
1188 # Note that kernel modules depend on themselves using the technique we use
1189 # $1 = function to call for each dependency we find
1190 # It will be passed the full path to the found kernel module
1191 # $2 = module to get dependencies for
1192 # rest of args = arguments to modprobe
1193 # _fderr specifies FD passed from surrounding scope
1194 for_each_kmod_dep
() {
1195 local _func
=$1 _kmod
=$2 _cmd _modpath _options _found
=0
1197 modprobe
"$@" --ignore-install --show-depends $_kmod 2>&${_fderr} |
(
1198 while read _cmd _modpath _options
; do
1199 [[ $_cmd = insmod
]] ||
continue
1200 $_func ${_modpath} ||
exit $?
1203 [[ $_found -eq 0 ]] && exit 1
1208 # filter kernel modules to install certain modules that meet specific
1210 # $1 = search only in subdirectory of /kernel/$1
1211 # $2 = function to call with module name to filter.
1212 # This function will be passed the full path to the module to test.
1213 # The behavior of this function can vary depending on whether $hostonly is set.
1214 # If it is, we will only look at modules that are already in memory.
1215 # If it is not, we will look at all kernel modules
1216 # This function returns the full filenames of modules that match $1
1217 filter_kernel_modules_by_path
() (
1218 local _modname _filtercmd
1219 if ! [[ $hostonly ]]; then
1220 _filtercmd
='find "$KERNEL_MODS/kernel/$1" "$KERNEL_MODS/extra"'
1221 _filtercmd
+=' "$KERNEL_MODS/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
1222 _filtercmd
+=' -o -name "*.ko.xz"'
1223 _filtercmd
+=' 2>/dev/null'
1225 _filtercmd
='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
1226 _filtercmd
+='-k $KERNEL_VER 2>/dev/null'
1228 for _modname
in $
(eval $_filtercmd); do
1230 *.ko
) "$2" "$_modname" && echo "$_modname";;
1231 *.ko.gz
) gzip -dc "$_modname" > $initdir/$$.ko
1232 $2 $initdir/$$.ko
&& echo "$_modname"
1233 rm -f $initdir/$$.ko
1235 *.ko.xz
) xz
-dc "$_modname" > $initdir/$$.ko
1236 $2 $initdir/$$.ko
&& echo "$_modname"
1237 rm -f $initdir/$$.ko
1242 find_kernel_modules_by_path
() (
1243 if ! [[ $hostonly ]]; then
1244 find "$KERNEL_MODS/kernel/$1" "$KERNEL_MODS/extra" "$KERNEL_MODS/weak-updates" \
1245 -name "*.ko" -o -name "*.ko.gz" -o -name "*.ko.xz" 2>/dev
/null
1247 cut
-d " " -f 1 </proc
/modules \
1248 |
xargs modinfo
-F filename
-k $KERNEL_VER 2>/dev
/null
1252 filter_kernel_modules
() {
1253 filter_kernel_modules_by_path drivers
"$1"
1256 find_kernel_modules
() {
1257 find_kernel_modules_by_path drivers
1260 # instmods [-c] <kernel module> [<kernel module> ... ]
1261 # instmods [-c] <kernel subsystem>
1262 # install kernel modules along with all their dependencies.
1263 # <kernel subsystem> can be e.g. "=block" or "=drivers/usb/storage"
1265 [[ $no_kernel = yes ]] && return
1266 # called [sub]functions inherit _fderr
1269 if [[ $1 = '-c' ]]; then
1274 function inst1mod
() {
1275 local _ret
=0 _mod
="$1"
1278 if [ -f $KERNEL_MODS/modules.
${_mod#=} ]; then
1279 ( [[ "$_mpargs" ]] && echo $_mpargs
1280 cat "${KERNEL_MODS}/modules.${_mod#=}" ) \
1283 ( [[ "$_mpargs" ]] && echo $_mpargs
1284 find "$KERNEL_MODS" -path "*/${_mod#=}/*" -printf '%f\n' ) \
1288 --*) _mpargs
+=" $_mod" ;;
1289 i2o_scsi
) return ;; # Do not load this diagnostic-only module
1292 # if we are already installed, skip this module and go on
1294 [[ -f "$initdir/.kernelmodseen/${_mod%.ko}.ko" ]] && return
1296 if [[ $omit_drivers ]] && [[ "$1" =~
$omit_drivers ]]; then
1297 dinfo
"Omitting driver ${_mod##$KERNEL_MODS}"
1300 # If we are building a host-specific initramfs and this
1301 # module is not already loaded, move on to the next one.
1302 [[ $hostonly ]] && ! grep -qe "\<${_mod//-/_}\>" /proc
/modules \
1303 && ! echo $add_drivers |
grep -qe "\<${_mod}\>" \
1306 # We use '-d' option in modprobe only if modules prefix path
1307 # differs from default '/'. This allows us to use Dracut with
1308 # old version of modprobe which doesn't have '-d' option.
1309 local _moddirname
=${KERNEL_MODS%%/lib/modules/*}
1310 [[ -n ${_moddirname} ]] && _moddirname
="-d ${_moddirname}/"
1312 # ok, load the module, all its dependencies, and any firmware
1314 for_each_kmod_dep install_kmod_with_fw
$_mod \
1315 --set-version $KERNEL_VER ${_moddirname} $_mpargs
1322 function instmods_1
() {
1324 if (($# == 0)); then # filenames from stdin
1326 inst1mod
"${_mod%.ko*}" ||
{
1327 if [ "$_check" = "yes" ]; then
1328 dfatal
"Failed to install $_mod"
1334 while (($# > 0)); do # filenames as arguments
1335 inst1mod
${1%.ko*} ||
{
1336 if [ "$_check" = "yes" ]; then
1337 dfatal
"Failed to install $1"
1346 local _ret _filter_not_found
='FATAL: Module .* not found.'
1348 # Capture all stderr from modprobe to _fderr. We could use {var}>...
1349 # redirections, but that would make dracut require bash4 at least.
1350 eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
1351 |
while read line
; do [[ "$line" =~
$_filter_not_found ]] && echo $line ||
echo $line >&2 ;done | derror
1357 # inst_libdir_file [-n <pattern>] <file> [<file>...]
1358 # Install a <file> located on a lib directory to the initramfs image
1359 # -n <pattern> install non-matching files
1360 inst_libdir_file
() {
1361 if [[ "$1" == "-n" ]]; then
1364 for _dir
in $libdirs; do
1366 for _f
in "$_dir"/$_i; do
1367 [[ "$_i" =~
$_pattern ]] ||
continue
1368 [[ -e "$_i" ]] && dracut_install
"$_i"
1373 for _dir
in $libdirs; do
1375 for _f
in "$_dir"/$_i; do
1376 [[ -e "$_f" ]] && dracut_install
"$_f"
1384 ln -s ..
/usr
/bin
/systemctl
$initdir/bin
/systemctl
1385 ln -s ..
/usr
/lib
/systemd
$initdir/lib
/systemd
1386 inst_simple
"/usr/lib/systemd/system/haveged.service"
1389 # can be overridden in specific test
1391 umount
$TESTDIR/root
2>/dev
/null || true
1392 [[ $LOOPDEV ]] && losetup
-d $LOOPDEV || true
1397 if [ -z "$TEST_NO_QEMU" ]; then
1399 check_result_qemu ||
return 1
1401 dwarn
"can't run QEMU, skipping"
1404 if [ -z "$TEST_NO_NSPAWN" ]; then
1406 check_result_nspawn ||
return 1
1408 dwarn
"can't run systemd-nspawn, skipping"
1415 if [[ $UID != "0" ]]; then
1416 echo "TEST: $TEST_DESCRIPTION [SKIPPED]: not root" >&2
1421 [[ $libdir ]] ||
for libdir
in /lib64
/lib
; do
1422 [[ -d $libdir ]] && libdirs
+=" $libdir" && break
1425 [[ $usrlibdir ]] ||
for usrlibdir
in /usr
/lib64
/usr
/lib
; do
1426 [[ -d $usrlibdir ]] && libdirs
+=" $usrlibdir" && break
1429 mkdir
-p "$STATEDIR"
1434 while (($# > 0)); do
1437 echo "TEST RUN: $TEST_DESCRIPTION"
1439 echo "TEST RUN: $TEST_DESCRIPTION [OK]"
1441 echo "TEST RUN: $TEST_DESCRIPTION [FAILED]"
1445 echo "TEST SETUP: $TEST_DESCRIPTION"
1449 echo "TEST CLEANUP: $TEST_DESCRIPTION"
1456 echo -n "TEST: $TEST_DESCRIPTION ";
1458 test_setup
&& test_run
1464 ) </dev
/null
>"$TESTLOG" 2>&1 || ret
=$?
1465 if [ $ret -eq 0 ]; then