From 63ab0f7db5a26a9e760ba5e3b8a029cad10abcb2 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 24 Jul 2009 22:12:12 +0200 Subject: add automatic-reuse-fs-sda test, which tests the "user has an existing partition he wants to reuse" scenario, with even a rollback and re-do it thrown in --- tests/runtime/automatic-reuse-fs-sda/install.sh | 15 +++++++++ .../runtime/automatic-reuse-fs-sda/perform_test.sh | 16 ++++++++++ tests/runtime/automatic-reuse-fs-sda/profile | 37 ++++++++++++++++++++++ tests/runtime/automatic-reuse-fs-sda/setup_test.sh | 6 ++++ 4 files changed, 74 insertions(+) create mode 100644 tests/runtime/automatic-reuse-fs-sda/install.sh create mode 100644 tests/runtime/automatic-reuse-fs-sda/perform_test.sh create mode 100644 tests/runtime/automatic-reuse-fs-sda/profile create mode 100644 tests/runtime/automatic-reuse-fs-sda/setup_test.sh (limited to 'tests/runtime') diff --git a/tests/runtime/automatic-reuse-fs-sda/install.sh b/tests/runtime/automatic-reuse-fs-sda/install.sh new file mode 100644 index 0000000..4b6b6f5 --- /dev/null +++ b/tests/runtime/automatic-reuse-fs-sda/install.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# sda1 boot, sda2 will be swap, sda3 /, sda4 which will contain the "existing filesystem of the user" with "important data" on it. +sfdisk /dev/sda << EOF +,50,,* +,20,S +,800, +,, +EOF +mke2fs -j /dev/sda4 +mkdir /tmp/aif-test-mount +mount /dev/sda4 /tmp/aif-test-mount +touch /tmp/aif-test-mount/important-userdata +umount /tmp/aif-test-mount +aif -p automatic -c /usr/share/aif/tests/runtime/automatic-reuse-fs-sda/profile -d \ No newline at end of file diff --git a/tests/runtime/automatic-reuse-fs-sda/perform_test.sh b/tests/runtime/automatic-reuse-fs-sda/perform_test.sh new file mode 100644 index 0000000..5f35676 --- /dev/null +++ b/tests/runtime/automatic-reuse-fs-sda/perform_test.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +source /usr/share/aif/tests/lib/framework-runtime + +aiftest swap 48 +aiftest lvm-lv cryptpool cryptroot '800.00 MB' +aiftest mount '/dev/sda3 on / type ext4 (rw)' +aiftest mount '/dev/sda4 on /home type ext3 (rw)' +for i in /etc/ / /root/ /home/ /var/ +do + aiftest file "$i"test_file +done +aiftest file /home/important-userdata +aiftest ping 2 archlinux.org + +aiftest-done diff --git a/tests/runtime/automatic-reuse-fs-sda/profile b/tests/runtime/automatic-reuse-fs-sda/profile new file mode 100644 index 0000000..e5aadb5 --- /dev/null +++ b/tests/runtime/automatic-reuse-fs-sda/profile @@ -0,0 +1,37 @@ +TARGET_PACKAGES='aif' + +GRUB_DEVICE=/dev/sda + +# modify worker_prepare_disks: we don't want to repartition (process_disks). also we want to do a rollback + setup again + +worker_prepare_disks () +{ + echo "$var_BLOCKDATA" > $TMP_BLOCKDEVICES + if process_filesystems + then + infofy "disk processing ok" + else + show_warning "PROCESSING FAILED" + return 1 + fi + if rollback_filesystems + then + infofy "rollback ok" + else + show_warning "ROLLBACK FAILED" + return 1 + fi + if process_filesystems + then + infofy "disk processing ok" + else + show_warning "PROCESSING FAILED" + return 1 + fi +} + + +BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params +/dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params +/dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params +/dev/sda4 raw no_label ext3:no:/home;target;no_opts;no_label;no_params' diff --git a/tests/runtime/automatic-reuse-fs-sda/setup_test.sh b/tests/runtime/automatic-reuse-fs-sda/setup_test.sh new file mode 100644 index 0000000..d5bc0d0 --- /dev/null +++ b/tests/runtime/automatic-reuse-fs-sda/setup_test.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +for i in /etc/ / /root/ /home/ /var/ +do + touch /mnt${i}test_file +done -- cgit v1.2.3-54-g00ecf