Blob Blame History Raw
From 27fa604418517c8e8a8e771ce6a804d4886e9f2f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 9 Jul 2012 15:30:15 +0200
Subject: [PATCH] test: export initdir

---
 test/TEST-01-BASIC/test.sh        |    6 +++---
 test/TEST-02-SYSTEMD/test.sh      |    6 +++---
 test/TEST-03-USR-MOUNT/test.sh    |    6 +++---
 test/TEST-10-RAID/test.sh         |    6 +++---
 test/TEST-11-LVM/test.sh          |    6 +++---
 test/TEST-12-RAID-DEG/test.sh     |    6 +++---
 test/TEST-13-ENC-RAID-LVM/test.sh |    6 +++---
 test/TEST-15-BTRFSRAID/test.sh    |    6 +++---
 test/TEST-16-DMSQUASH/test.sh     |    4 ++--
 test/TEST-20-NFS/test.sh          |    6 +++---
 test/TEST-30-ISCSI/test.sh        |    8 ++++----
 test/TEST-40-NBD/test.sh          |   10 +++++-----
 test/TEST-50-MULTINIC/test.sh     |    6 +++---
 test/old.TEST-14-IMSM/test.sh     |    6 +++---
 test/test-functions               |    2 +-
 15 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 35e05bb..f8522e6 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -27,7 +27,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	mkdir -p $initdir
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
@@ -49,7 +49,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mkfs.ext3 poweroff cp umount sync
 	inst_hook initqueue 01 ./create-root.sh
@@ -77,7 +77,7 @@ test_setup() {
 
 
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh
index b535dbe..5a121c0 100755
--- a/test/TEST-02-SYSTEMD/test.sh
+++ b/test/TEST-02-SYSTEMD/test.sh
@@ -23,7 +23,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	mkdir -p $initdir
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
@@ -45,7 +45,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mkfs.ext3 poweroff cp umount
 	inst_hook initqueue 01 ./create-root.sh
@@ -73,7 +73,7 @@ test_setup() {
 
 
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
index d966c3c..f3237d3 100755
--- a/test/TEST-03-USR-MOUNT/test.sh
+++ b/test/TEST-03-USR-MOUNT/test.sh
@@ -54,7 +54,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	mkdir -p $initdir
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
@@ -77,7 +77,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mkfs.btrfs btrfs poweroff cp umount sync
 	inst_hook initqueue 01 ./create-root.sh
@@ -112,7 +112,7 @@ test_setup() {
 
 
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index ef6d0c2..d2b1921 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -25,7 +25,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	(mkdir -p "$initdir"; cd "$initdir"; mkdir -p dev sys proc etc var/run tmp run)
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
@@ -46,7 +46,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mke2fs poweroff cp umount
 	inst_hook initqueue 01 ./create-root.sh
@@ -72,7 +72,7 @@ test_setup() {
     grep -m 1 -q dracut-root-block-created $DISKIMAGE || return 1
 
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh
index 034cc4c..61ebdfa 100755
--- a/test/TEST-11-LVM/test.sh
+++ b/test/TEST-11-LVM/test.sh
@@ -23,7 +23,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
 	    mount dmesg ifconfig dhclient mkdir cp ping dhclient
@@ -44,7 +44,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mke2fs poweroff cp umount
 	inst_hook initqueue 01 ./create-root.sh
@@ -66,7 +66,7 @@ test_setup() {
 	-initrd $TESTDIR/initramfs.makeroot  || return 1
     grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh
index c6038bd..05e5f8a 100755
--- a/test/TEST-12-RAID-DEG/test.sh
+++ b/test/TEST-12-RAID-DEG/test.sh
@@ -58,7 +58,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
 	    mount dmesg ifconfig dhclient mkdir cp ping dhclient
@@ -78,7 +78,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mke2fs poweroff cp umount dd grep
 	inst_hook initqueue 01 ./create-root.sh
@@ -106,7 +106,7 @@ test_setup() {
     grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
     eval $(grep --binary-files=text -m 1 MD_UUID $TESTDIR/root.ext2)
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh
index 658de8f..f0f7d34 100755
--- a/test/TEST-13-ENC-RAID-LVM/test.sh
+++ b/test/TEST-13-ENC-RAID-LVM/test.sh
@@ -59,7 +59,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
 	    mount dmesg ifconfig dhclient mkdir cp ping dhclient
@@ -79,7 +79,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mke2fs poweroff cp umount grep
 	inst_hook initqueue 01 ./create-root.sh
@@ -108,7 +108,7 @@ test_setup() {
 
 
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh
index 5918b5e..61ccae3 100755
--- a/test/TEST-15-BTRFSRAID/test.sh
+++ b/test/TEST-15-BTRFSRAID/test.sh
@@ -25,7 +25,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
 	    mount dmesg ifconfig dhclient mkdir cp ping dhclient
@@ -45,7 +45,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mkfs.btrfs poweroff cp umount
 	inst_hook initqueue 01 ./create-root.sh
@@ -74,7 +74,7 @@ test_setup() {
     grep -m 1 -q dracut-root-block-created $DISKIMAGE || return 1
 
    (
-	initdir=$TESTDIR/overlay
+        export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
index 5cd9986..4dc133c 100755
--- a/test/TEST-16-DMSQUASH/test.sh
+++ b/test/TEST-16-DMSQUASH/test.sh
@@ -29,7 +29,7 @@ test_run() {
 test_setup() {
     mkdir -p $TESTDIR/overlay
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
@@ -47,7 +47,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/root-source
+	export initdir=$TESTDIR/root-source
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
 	    mount dmesg ifconfig dhclient mkdir cp ping dhclient \
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 57bf512..a44f6c0 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -217,7 +217,7 @@ test_setup() {
     # Detect lib paths
 
    (
-    	initdir=$TESTDIR/mnt
+       export initdir=$TESTDIR/mnt
 	. $basedir/dracut-functions.sh
 
 	for _f in modules.builtin.bin modules.builtin; do
@@ -282,7 +282,7 @@ test_setup() {
 
     # Make client root inside server root
     (
-	initdir=$TESTDIR/mnt/nfs/client
+	export initdir=$TESTDIR/mnt/nfs/client
 	. $basedir/dracut-functions.sh
 
 	dracut_install sh shutdown poweroff stty cat ps ln ip \
@@ -325,7 +325,7 @@ test_setup() {
 
     # Make an overlay with needed tools for the test harness
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	mkdir $TESTDIR/overlay
 	dracut_install poweroff shutdown
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 8c577f0..c5dba80 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -102,7 +102,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-        initdir=$TESTDIR/overlay/source
+        export initdir=$TESTDIR/overlay/source
         . $basedir/dracut-functions.sh
         dracut_install sh shutdown poweroff stty cat ps ln ip \
             mount dmesg mkdir cp ping grep
@@ -118,7 +118,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-        initdir=$TESTDIR/overlay
+        export initdir=$TESTDIR/overlay
         . $basedir/dracut-functions.sh
         dracut_install sfdisk mkfs.ext3 poweroff cp umount
         inst_hook initqueue 01 ./create-root.sh
@@ -153,7 +153,7 @@ test_setup() {
     grep -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
     rm $TESTDIR/client.img
     (
-        initdir=$TESTDIR/overlay
+        export initdir=$TESTDIR/overlay
         . $basedir/dracut-functions.sh
         dracut_install poweroff shutdown
         inst_hook emergency 000 ./hard-off.sh
@@ -173,7 +173,7 @@ test_setup() {
 
     kernel=$KVERSION
     (
-        initdir=$TESTDIR/mnt
+        export initdir=$TESTDIR/mnt
         . $basedir/dracut-functions.sh
         (
             cd "$initdir";
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index f5465b6..94efb8a 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -190,7 +190,7 @@ make_encrypted_root() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
         . $basedir/dracut-functions.sh
         mkdir -p "$initdir"
 	(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
@@ -208,7 +208,7 @@ make_encrypted_root() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install mke2fs poweroff cp umount tune2fs
 	inst_hook initqueue 01 ./create-root.sh
@@ -244,7 +244,7 @@ make_client_root() {
 
     kernel=$KVERSION
     (
-	initdir=$TESTDIR/mnt
+	export initdir=$TESTDIR/mnt
 	. $basedir/dracut-functions.sh
         mkdir -p "$initdir"
 	(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
@@ -278,7 +278,7 @@ make_server_root() {
 
     kernel=$KVERSION
     (
-	initdir=$TESTDIR/mnt
+	export initdir=$TESTDIR/mnt
 	. $basedir/dracut-functions.sh
         mkdir -p "$initdir"
 	(
@@ -323,7 +323,7 @@ test_setup() {
 
     # Make the test image
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
index a96669e..74f10d8 100755
--- a/test/TEST-50-MULTINIC/test.sh
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -132,7 +132,7 @@ test_setup() {
     sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
 
     (
-        initdir=$TESTDIR/mnt
+        export initdir=$TESTDIR/mnt
         . $basedir/dracut-functions.sh
 
         (
@@ -197,7 +197,7 @@ test_setup() {
 
     # Make client root inside server root
     (
-        initdir=$TESTDIR/mnt/nfs/client
+        export initdir=$TESTDIR/mnt/nfs/client
         . $basedir/dracut-functions.sh
         dracut_install sh shutdown poweroff stty cat ps ln ip \
             mount dmesg mkdir cp ping grep ls
@@ -236,7 +236,7 @@ test_setup() {
 
     # Make an overlay with needed tools for the test harness
     (
-        initdir=$TESTDIR/overlay
+        export initdir=$TESTDIR/overlay
         . $basedir/dracut-functions.sh
         dracut_install poweroff shutdown
         inst_hook emergency 000 ./hard-off.sh
diff --git a/test/old.TEST-14-IMSM/test.sh b/test/old.TEST-14-IMSM/test.sh
index 5b9438e..cd2d715 100755
--- a/test/old.TEST-14-IMSM/test.sh
+++ b/test/old.TEST-14-IMSM/test.sh
@@ -57,7 +57,7 @@ test_setup() {
     kernel=$KVERSION
     # Create what will eventually be our root filesystem onto an overlay
     (
-	initdir=$TESTDIR/overlay/source
+	export initdir=$TESTDIR/overlay/source
 	. $basedir/dracut-functions.sh
 	dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
 	    mount dmesg ifconfig dhclient mkdir cp ping dhclient
@@ -78,7 +78,7 @@ test_setup() {
 
     # second, install the files needed to make the root filesystem
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install sfdisk mke2fs poweroff cp umount
 	inst_hook initqueue 01 ./create-root.sh
@@ -104,7 +104,7 @@ test_setup() {
 	-initrd $TESTDIR/initramfs.makeroot  || return 1
     grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
     (
-	initdir=$TESTDIR/overlay
+	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-functions.sh
 	dracut_install poweroff shutdown
 	inst_hook emergency 000 ./hard-off.sh
diff --git a/test/test-functions b/test/test-functions
index 451837f..10d78ed 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -6,7 +6,7 @@ export PATH
 
 [[ -e .testdir ]] && . .testdir
 if [[ -z "$TESTDIR" ]] || [[ ! -d "$TESTDIR" ]]; then
-   TESTDIR=$(mktemp -d -t dracut-test.XXXXXX)
+   TESTDIR=$(mktemp -d --tmpdir="/var/tmp" -t dracut-test.XXXXXX)
 fi
 echo "TESTDIR=\"$TESTDIR\"" > .testdir
 export TESTDIR