diff options
author | Baruch Siach <baruch@tkos.co.il> | 2024-03-17 20:33:25 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-04-04 14:05:03 +0100 |
commit | 0c9d83138e2064cb91d43fb7a2915ef90d8e0b46 (patch) | |
tree | 19fb5e9a38e119bc709c46692c4c99ec30399a80 /meta/lib | |
parent | 61b7acdb76228f3f179564a745a1c9b35d7f1946 (diff) | |
download | poky-0c9d83138e2064cb91d43fb7a2915ef90d8e0b46.tar.gz |
oeqa/selftest/overlayfs: test read-only rootfs
Use the read-only squashfs filesystem to test the read-only case.
(From OE-Core rev: 1a61da196f014dc34a998d3e46f03abc79ebc84d)
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/overlayfs.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py index cd0dc60c64..e31063567b 100644 --- a/meta/lib/oeqa/selftest/cases/overlayfs.py +++ b/meta/lib/oeqa/selftest/cases/overlayfs.py | |||
@@ -353,6 +353,7 @@ EXTRA_IMAGE_FEATURES += "read-only-rootfs" | |||
353 | # Image configuration for overlayfs-etc | 353 | # Image configuration for overlayfs-etc |
354 | OVERLAYFS_ETC_MOUNT_POINT = "/data" | 354 | OVERLAYFS_ETC_MOUNT_POINT = "/data" |
355 | OVERLAYFS_ETC_DEVICE = "/dev/sda3" | 355 | OVERLAYFS_ETC_DEVICE = "/dev/sda3" |
356 | OVERLAYFS_ROOTFS_TYPE = "ext4" | ||
356 | """ | 357 | """ |
357 | 358 | ||
358 | self.write_config(config) | 359 | self.write_config(config) |
@@ -367,13 +368,17 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3" | |||
367 | 368 | ||
368 | @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently") | 369 | @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently") |
369 | def test_sbin_init_preinit(self): | 370 | def test_sbin_init_preinit(self): |
370 | self.run_sbin_init(False) | 371 | self.run_sbin_init(False, "ext4") |
371 | 372 | ||
372 | @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently") | 373 | @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently") |
373 | def test_sbin_init_original(self): | 374 | def test_sbin_init_original(self): |
374 | self.run_sbin_init(True) | 375 | self.run_sbin_init(True, "ext4") |
375 | 376 | ||
376 | def run_sbin_init(self, origInit): | 377 | @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently") |
378 | def test_sbin_init_read_only(self): | ||
379 | self.run_sbin_init(True, "squashfs") | ||
380 | |||
381 | def run_sbin_init(self, origInit, rootfsType): | ||
377 | """ | 382 | """ |
378 | Summary: Confirm we can replace original init and mount overlay on top of /etc | 383 | Summary: Confirm we can replace original init and mount overlay on top of /etc |
379 | Expected: Image is created successfully and /etc is mounted as an overlay | 384 | Expected: Image is created successfully and /etc is mounted as an overlay |
@@ -384,7 +389,9 @@ OVERLAYFS_ETC_DEVICE = "/dev/sda3" | |||
384 | 389 | ||
385 | args = { | 390 | args = { |
386 | 'OVERLAYFS_INIT_OPTION': "" if origInit else "init=/sbin/preinit", | 391 | 'OVERLAYFS_INIT_OPTION': "" if origInit else "init=/sbin/preinit", |
387 | 'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': int(origInit == True) | 392 | 'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': int(origInit == True), |
393 | 'OVERLAYFS_ROOTFS_TYPE': rootfsType, | ||
394 | 'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': int(rootfsType == "ext4") | ||
388 | } | 395 | } |
389 | 396 | ||
390 | self.write_config(config.format(**args)) | 397 | self.write_config(config.format(**args)) |
@@ -437,7 +444,9 @@ IMAGE_INSTALL:append = " overlayfs-user" | |||
437 | 444 | ||
438 | args = { | 445 | args = { |
439 | 'OVERLAYFS_INIT_OPTION': "", | 446 | 'OVERLAYFS_INIT_OPTION': "", |
440 | 'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1 | 447 | 'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1, |
448 | 'OVERLAYFS_ROOTFS_TYPE': "ext4", | ||
449 | 'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': 1 | ||
441 | } | 450 | } |
442 | 451 | ||
443 | self.write_config(config.format(**args)) | 452 | self.write_config(config.format(**args)) |
@@ -463,10 +472,14 @@ IMAGE_INSTALL:append = " overlayfs-user" | |||
463 | INIT_MANAGER = "systemd" | 472 | INIT_MANAGER = "systemd" |
464 | 473 | ||
465 | # enable overlayfs in the kernel | 474 | # enable overlayfs in the kernel |
466 | KERNEL_EXTRA_FEATURES:append = " features/overlayfs/overlayfs.scc" | 475 | KERNEL_EXTRA_FEATURES:append = " \ |
476 | features/overlayfs/overlayfs.scc \ | ||
477 | cfg/fs/squashfs.scc" | ||
467 | 478 | ||
468 | IMAGE_FSTYPES += "wic" | 479 | IMAGE_FSTYPES += "wic" |
469 | OVERLAYFS_INIT_OPTION = "{OVERLAYFS_INIT_OPTION}" | 480 | OVERLAYFS_INIT_OPTION = "{OVERLAYFS_INIT_OPTION}" |
481 | OVERLAYFS_ROOTFS_TYPE = "{OVERLAYFS_ROOTFS_TYPE}" | ||
482 | OVERLAYFS_ETC_CREATE_MOUNT_DIRS = "{OVERLAYFS_ETC_CREATE_MOUNT_DIRS}" | ||
470 | WKS_FILE = "overlayfs_etc.wks.in" | 483 | WKS_FILE = "overlayfs_etc.wks.in" |
471 | 484 | ||
472 | EXTRA_IMAGE_FEATURES += "read-only-rootfs" | 485 | EXTRA_IMAGE_FEATURES += "read-only-rootfs" |
@@ -477,4 +490,13 @@ OVERLAYFS_ETC_MOUNT_POINT = "/data" | |||
477 | OVERLAYFS_ETC_FSTYPE = "ext4" | 490 | OVERLAYFS_ETC_FSTYPE = "ext4" |
478 | OVERLAYFS_ETC_DEVICE = "/dev/sda3" | 491 | OVERLAYFS_ETC_DEVICE = "/dev/sda3" |
479 | OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}" | 492 | OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "{OVERLAYFS_ETC_USE_ORIG_INIT_NAME}" |
493 | |||
494 | ROOTFS_POSTPROCESS_COMMAND += "{OVERLAYFS_ROOTFS_TYPE}_rootfs" | ||
495 | |||
496 | ext4_rootfs() {{ | ||
497 | }} | ||
498 | |||
499 | squashfs_rootfs() {{ | ||
500 | mkdir -p ${{IMAGE_ROOTFS}}/data | ||
501 | }} | ||
480 | """ | 502 | """ |