From 74fb88f9ac674ccbe2aacf2e6a9e1298b692c50c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 8 May 2020 21:07:17 +0200 Subject: [PATCH] [rawfs] Minor testing support - set *bogus* to do no harm - add some test configurations --- src/modules/rawfs/main.py | 2 ++ src/modules/rawfs/rawfs.conf | 5 +++++ src/modules/rawfs/tests/1.global | 9 +++++++++ src/modules/rawfs/tests/1.job | 14 ++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 src/modules/rawfs/tests/1.global create mode 100644 src/modules/rawfs/tests/1.job diff --git a/src/modules/rawfs/main.py b/src/modules/rawfs/main.py index d0f235372..1898d8fea 100644 --- a/src/modules/rawfs/main.py +++ b/src/modules/rawfs/main.py @@ -96,6 +96,8 @@ class RawFSItem: count = 0 libcalamares.utils.debug("Copying {} to {}".format(self.source, self.destination)) + if libcalamares.job.configuration["bogus"]: + return srcsize, srcblksize = get_device_size(self.source) destsize, destblksize = get_device_size(self.destination) diff --git a/src/modules/rawfs/rawfs.conf b/src/modules/rawfs/rawfs.conf index 10e654a7d..8d7da3ba3 100644 --- a/src/modules/rawfs/rawfs.conf +++ b/src/modules/rawfs/rawfs.conf @@ -22,3 +22,8 @@ targets: resize: true - mountPoint: /data source: /dev/mmcblk0p3 + +# To support testing, set the *bogus* key to true. No actual work is done, but the +# module's logic is exercised. + +# bogus: false diff --git a/src/modules/rawfs/tests/1.global b/src/modules/rawfs/tests/1.global new file mode 100644 index 000000000..c09df9375 --- /dev/null +++ b/src/modules/rawfs/tests/1.global @@ -0,0 +1,9 @@ +--- +rootMountPoint: /tmp/unpackfs-test-run-rootdir3/ +partitions: + - mountPoint: / + device: /dev/sda1 + fs: ext4 + - mountPoint: /home + device: /dev/sda2 + fs: ext4 diff --git a/src/modules/rawfs/tests/1.job b/src/modules/rawfs/tests/1.job new file mode 100644 index 000000000..6079c43ed --- /dev/null +++ b/src/modules/rawfs/tests/1.job @@ -0,0 +1,14 @@ +# Testing configuration for rawfs + +--- + +targets: + - mountPoint: / + source: / + - mountPoint: /home + source: /images/home.img + resize: true + - mountPoint: /data + source: /dev/mmcblk0p3 + +bogus: true