3 # Copyright (C) SUSE LINUX GmbH 2016, all rights reserved.
5 # This library is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published
7 # by the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) version 3.
10 # This library is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 # License for more details.
15 if [ ! -f /vm_autorun.env ]; then
16 echo "Error: autorun scripts must be run from within an initramfs VM"
24 # path to xfstests within the initramfs
25 XFSTESTS_DIR="/fstests"
27 hostname_fqn="`cat /proc/sys/kernel/hostname`" || _fatal "hostname unavailable"
28 hostname_short="${hostname_fqn%%.*}"
31 # need hosts file for hostname -s
32 cat > /etc/hosts <<EOF
33 127.0.0.1 $hostname_fqn $hostname_short
38 cat /proc/mounts | grep debugfs &> /dev/null
40 mount -t debugfs debugfs /sys/kernel/debug/
43 cat /proc/mounts | grep configfs &> /dev/null
45 mount -t configfs configfs /sys/kernel/config/
48 modprobe zram num_devices="2" || _fatal "failed to load zram module"
50 echo "1G" > /sys/block/zram0/disksize || _fatal "failed to set zram disksize"
51 echo "1G" > /sys/block/zram1/disksize || _fatal "failed to set zram disksize"
53 mkfs.${filesystem} /dev/zram0 || _fatal "mkfs failed"
54 mkfs.${filesystem} /dev/zram1 || _fatal "mkfs failed"
56 for i in $DYN_DEBUG_MODULES; do
57 echo "module $i +pf" > /sys/kernel/debug/dynamic_debug/control || _fatal
59 for i in $DYN_DEBUG_FILES; do
60 echo "file $i +pf" > /sys/kernel/debug/dynamic_debug/control || _fatal
66 mount -t $filesystem /dev/zram0 /mnt/test || _fatal
67 mount -t $filesystem /dev/zram1 /mnt/scratch || _fatal
69 if [ -d ${XFSTESTS_DIR} ]; then
70 cat > ${XFSTESTS_DIR}/configs/`hostname -s`.config << EOF
74 SCRATCH_MNT=/mnt/scratch
75 SCRATCH_DEV=/dev/zram1
81 echo "$filesystem filesystem mounted at /mnt/test and /mnt/scratch"
83 if [ -n "$FSTESTS_AUTORUN_CMD" ]; then
84 cd ${XFSTESTS_DIR} || _fatal
85 eval "$FSTESTS_AUTORUN_CMD"