Skip to content

Commit

Permalink
tests: secureboot: imx: refactor bootloader config integrity tests
Browse files Browse the repository at this point in the history
Refactor to assure sequential execution of tests.

Change-type: patch
Signed-off-by: Alex Gonzalez <[email protected]>
  • Loading branch information
alexgg committed Jan 13, 2025
1 parent 0d158c9 commit 68c2f40
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions tests/suites/os/tests/secureboot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,32 +470,32 @@ class imxSecureBoot extends secureBoot {
}

async testBootloaderConfigIntegrity() {
await Promise.all(
[
{ path: '/mnt/imx/resinOS_uEnv.txt', variable: 'extra_os_cmdline', value: 'test' },
{ path: '/mnt/imx/extra_uEnv.txt', variable: 'extra_os_cmdline', value: 'test' },
{ path: '/mnt/imx/bootcount.env', variable: 'extra_os_cmdline', value: 'test' },
].map(async (args) => {
await this.worker.executeCommandInHostOS(
`echo '${args.variable}=${args.value}' >> ${args.path} && sync -f $(dirname ${args.path})`,
this.link
)
await this.worker.rebootDut(this.link);
let cmdline = await this.worker.executeCommandInHostOS(
'cat /proc/cmdline',
this.link,
);
await this.test.equal(
cmdline.includes(`${args.value}`),
false,
`Kernel command line has not been modified by ${path.basename(args.path)}`,
)
await this.worker.executeCommandInHostOS(
`rm -f ${args.path} && sync -f $(dirname ${args.path})`,
this.link,
);
})
);
const tests = [
{ path: '/mnt/imx/resinOS_uEnv.txt', variable: 'extra_os_cmdline', value: 'test' },
{ path: '/mnt/imx/extra_uEnv.txt', variable: 'extra_os_cmdline', value: 'test' },
{ path: '/mnt/imx/bootcount.env', variable: 'extra_os_cmdline', value: 'test' },
];

for (const args of tests) {
await this.worker.executeCommandInHostOS(
`echo '${args.variable}=${args.value}' >> ${args.path} && sync -f $(dirname ${args.path})`,
this.link
)
await this.worker.rebootDut(this.link);
let cmdline = await this.worker.executeCommandInHostOS(
'cat /proc/cmdline',
this.link,
);
await this.test.equal(
cmdline.includes(`${args.value}`),
false,
`Kernel command line has not been modified by ${path.basename(args.path)}`,
)
await this.worker.executeCommandInHostOS(
`rm -f ${args.path} && sync -f $(dirname ${args.path})`,
this.link,
);
}

/* Note that the balena bootloader bootenv cannot be used to
* inject kernel command line arguments at the moment */
Expand Down

0 comments on commit 68c2f40

Please sign in to comment.