summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--tests/guests/Makefile.am8
-rwxr-xr-xtests/guests/guest-aux/make-debian-img.sh10
-rwxr-xr-xtests/guests/guest-aux/make-fedora-img.pl26
-rwxr-xr-xtests/guests/guest-aux/make-ubuntu-img.sh14
-rwxr-xr-xtests/guests/guest-aux/make-windows-img.sh4
6 files changed, 34 insertions, 29 deletions
diff --git a/.gitignore b/.gitignore
index f70feea8..a31c6ceb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -405,6 +405,7 @@ pod2htm?.tmp
/tests/guests/fedora-md2.img
/tests/guests/guest-aux/fedora-name.db
/tests/guests/guest-aux/fedora-packages.db
+/tests/guests/stamp-fedora-md.img
/tests/guests/ubuntu.img
/tests/guests/windows.img
/tests/regressions/rhbz501893
diff --git a/tests/guests/Makefile.am b/tests/guests/Makefile.am
index 960f708a..e20d91ca 100644
--- a/tests/guests/Makefile.am
+++ b/tests/guests/Makefile.am
@@ -40,7 +40,7 @@ EXTRA_DIST = \
# time and we need the tools we have built in order to make it.
check_DATA = debian.img fedora.img fedora-md1.img fedora-md2.img ubuntu.img windows.img
-CLEANFILES = $(check_DATA)
+CLEANFILES = $(check_DATA) stamp-fedora-md.img
# Make a (dummy) Fedora image.
fedora.img: guest-aux/make-fedora-img.pl \
@@ -52,13 +52,17 @@ fedora.img: guest-aux/make-fedora-img.pl \
../../run $<
# Make a (dummy) Fedora image using md devices
-fedora-md1.img fedora-md2.img: guest-aux/make-fedora-img.pl \
+fedora-md1.img fedora-md2.img: stamp-fedora-md.img
+
+stamp-fedora-md.img: guest-aux/make-fedora-img.pl \
guest-aux/fedora-name.db \
guest-aux/fedora-packages.db
+ rm -f $@
TMPDIR=$(top_builddir) \
SRCDIR=$(srcdir) \
LAYOUT=partitions-md \
../../run $<
+ touch $@
guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt
rm -f $@ $@-t
diff --git a/tests/guests/guest-aux/make-debian-img.sh b/tests/guests/guest-aux/make-debian-img.sh
index f0c1597c..659e8ec5 100755
--- a/tests/guests/guest-aux/make-debian-img.sh
+++ b/tests/guests/guest-aux/make-debian-img.sh
@@ -22,7 +22,7 @@ export LANG=C
set -e
# fstab file.
-cat > fstab.tmp <<EOF
+cat > fstab.tmp.$$ <<EOF
LABEL=BOOT /boot ext2 default 0 0
/dev/debian/root / ext2 default 0 0
/dev/debian/usr /usr ext2 default 1 2
@@ -32,7 +32,7 @@ EOF
# Create a disk image.
../../run ../../fish/guestfish <<EOF
-sparse debian.img.tmp 512M
+sparse debian.img.tmp.$$ 512M
run
# Format the disk.
@@ -76,7 +76,7 @@ mkdir /bin
mkdir /etc
mkdir-p /var/lib/dpkg
-upload fstab.tmp /etc/fstab
+upload fstab.tmp.$$ /etc/fstab
write /etc/debian_version "5.0.1"
write /etc/hostname "debian.invalid"
@@ -88,5 +88,5 @@ mkdir /boot/grub
touch /boot/grub/grub.conf
EOF
-rm fstab.tmp
-mv debian.img.tmp debian.img
+rm fstab.tmp.$$
+mv debian.img.tmp.$$ debian.img
diff --git a/tests/guests/guest-aux/make-fedora-img.pl b/tests/guests/guest-aux/make-fedora-img.pl
index fbc189da..a26a9fd7 100755
--- a/tests/guests/guest-aux/make-fedora-img.pl
+++ b/tests/guests/guest-aux/make-fedora-img.pl
@@ -38,9 +38,9 @@ foreach ('LAYOUT', 'SRCDIR') {
}
if ($ENV{LAYOUT} eq 'partitions') {
- push (@images, 'fedora.img.tmp');
+ push (@images, "fedora.img.tmp.$$");
- open(my $fstab, '>', 'fstab.tmp') or die;
+ open(my $fstab, '>', "fstab.tmp.$$") or die;
print $fstab <<EOF;
LABEL=BOOT /boot ext2 default 0 0
LABEL=ROOT / ext2 default 0 0
@@ -50,11 +50,11 @@ EOF
$bootdev = '/dev/sda1';
$rootdev = '/dev/sda2';
- open(my $img, '>', 'fedora.img.tmp') or die;
+ open(my $img, '>', "fedora.img.tmp.$$") or die;
truncate($img, 512*1024*1024) or die;
close($img) or die;
- $g->add_drive('fedora.img.tmp');
+ $g->add_drive("fedora.img.tmp.$$");
$g->launch();
$g->part_init('/dev/sda', 'mbr');
@@ -63,9 +63,9 @@ EOF
}
elsif ($ENV{LAYOUT} eq 'partitions-md') {
- push(@images, 'fedora-md1.img.tmp', 'fedora-md2.img.tmp');
+ push(@images, "fedora-md1.img.tmp.$$", "fedora-md2.img.tmp.$$");
- open(my $fstab, '>', 'fstab.tmp') or die;
+ open(my $fstab, '>', "fstab.tmp.$$") or die;
print $fstab <<EOF;
/dev/md0 /boot ext2 default 0 0
LABEL=ROOT / ext2 default 0 0
@@ -95,7 +95,7 @@ EOF
$g->md_create('boot', ['/dev/sda1', '/dev/sdb1']);
$g->md_create('root', ['/dev/sda2', '/dev/sdb2']);
- open(my $mdadm, '>', 'mdadm.tmp') or die;
+ open(my $mdadm, '>', "mdadm.tmp.$$") or die;
print $mdadm <<EOF;
MAILADDR root
AUTO +imsm +1.x -all
@@ -144,14 +144,14 @@ $g->mkdir('/etc/sysconfig');
$g->mkdir('/usr');
$g->mkdir_p('/var/lib/rpm');
-$g->upload('fstab.tmp', '/etc/fstab');
+$g->upload("fstab.tmp.$$", '/etc/fstab');
$g->write('/etc/redhat-release', 'Fedora release 14 (Phony)');
$g->write('/etc/fedora-release', 'Fedora release 14 (Phony)');
$g->write('/etc/sysconfig/network', 'HOSTNAME=fedora.invalid');
-if (-f 'mdadm.tmp') {
- $g->upload('mdadm.tmp', '/etc/mdadm.conf');
- unlink('mdadm.tmp') or die;
+if (-f "mdadm.tmp.$$") {
+ $g->upload("mdadm.tmp.$$", '/etc/mdadm.conf');
+ unlink("mdadm.tmp.$$") or die;
}
$g->upload('guest-aux/fedora-name.db', '/var/lib/rpm/Name');
@@ -190,8 +190,8 @@ $g->mkfs_opts('ext2', '/dev/VG/LV2', blocksize => 1024);
$g->mkfs_opts('ext2', '/dev/VG/LV3', blocksize => 2048);
# Cleanup
-unlink('fstab.tmp') or die;
+unlink("fstab.tmp.$$") or die;
foreach my $img (@images) {
- $img =~ /^(.*)\.tmp$/ or die;
+ $img =~ /^(.*)\.tmp\.\d+$/ or die;
rename($img, $1) or die;
}
diff --git a/tests/guests/guest-aux/make-ubuntu-img.sh b/tests/guests/guest-aux/make-ubuntu-img.sh
index a2b4d173..62f3cc9f 100755
--- a/tests/guests/guest-aux/make-ubuntu-img.sh
+++ b/tests/guests/guest-aux/make-ubuntu-img.sh
@@ -22,13 +22,13 @@ export LANG=C
set -e
# fstab file.
-cat > fstab.tmp <<EOF
+cat > fstab.tmp.$$ <<EOF
LABEL=BOOT /boot ext2 default 0 0
/dev/sda2 / ext2 default 1 2
EOF
# lsb-release file.
-cat > release.tmp <<'EOF'
+cat > release.tmp.$$ <<'EOF'
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
@@ -37,7 +37,7 @@ EOF
# Create a disk image.
../../run ../../fish/guestfish <<EOF
-sparse ubuntu.img.tmp 512M
+sparse ubuntu.img.tmp.$$ 512M
run
# Format the disk.
@@ -64,9 +64,9 @@ mkdir /home
mkdir /usr
mkdir-p /var/lib/dpkg
-upload fstab.tmp /etc/fstab
+upload fstab.tmp.$$ /etc/fstab
write /etc/debian_version "5.0.1"
-upload release.tmp /etc/lsb-release
+upload release.tmp.$$ /etc/lsb-release
write /etc/hostname "ubuntu.invalid"
upload $SRCDIR/guest-aux/debian-packages /var/lib/dpkg/status
@@ -77,5 +77,5 @@ mkdir /boot/grub
touch /boot/grub/grub.conf
EOF
-rm fstab.tmp release.tmp
-mv ubuntu.img.tmp ubuntu.img
+rm fstab.tmp.$$ release.tmp.$$
+mv ubuntu.img.tmp.$$ ubuntu.img
diff --git a/tests/guests/guest-aux/make-windows-img.sh b/tests/guests/guest-aux/make-windows-img.sh
index a6937a99..89a305cd 100755
--- a/tests/guests/guest-aux/make-windows-img.sh
+++ b/tests/guests/guest-aux/make-windows-img.sh
@@ -37,7 +37,7 @@ fi
# Create a disk image.
../../run ../../fish/guestfish <<EOF
-sparse windows.img.tmp 512M
+sparse windows.img.tmp.$$ 512M
run
# Format the disk.
@@ -68,4 +68,4 @@ touch /autoexec.bat
EOF
-mv windows.img.tmp windows.img
+mv windows.img.tmp.$$ windows.img