Skip to content

Commit

Permalink
tests/os: Add kernel - dtb overlap test
Browse files Browse the repository at this point in the history
If a kernel or dtb overlap or overwrite is detected in u-boot,
a file named overlap_detected is created in the boot partition.

In this test we check for the presence of this file.

Signed-off-by: Alexandru Costache <alexandru@balena.io>
  • Loading branch information
acostach committed May 31, 2023
1 parent 00d84fc commit c1e6515
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/suites/os/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ module.exports = {
'./tests/secureboot',
'./tests/device-specific-tests/beaglebone-black',
'./tests/device-specific-tests/243390-rpi3',
'./tests/overlap_test/',
'./tests/fingerprint',
'./tests/fsck',
'./tests/os-release',
Expand Down
21 changes: 21 additions & 0 deletions tests/suites/os/tests/overlap_test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
title: 'Kernel and device-tree overlap test',
run: async function(test) {
test.comment(`Checking if the kernel or the device-tree have been overwritten`);
let result = '';
result = await this.context
.get()
.worker.executeCommandInHostOS(
`if [ -e /mnt/boot/overlap_detected ]; then echo "Test failed"; else echo "OK"; fi;`,
this.link,
);

if (result.includes('OK')) {
test.comment(`not ok! - kernel - dtb overlap detected`);
} else {
test.comment(`ok - no overlap detected`);
}

test.is(result.includes('OK'), true, 'Kernel - dtb overlap check completed');
},
};

0 comments on commit c1e6515

Please sign in to comment.