Skip to content

Commit

Permalink
tests/os: Add Jetson Orin device-specific fan and power mode smoke tests
Browse files Browse the repository at this point in the history
These tests are the same for all public Orin device types
and validate that the power mode and the fan profile can be
changed by writing directly to the config.json file
in the boot partition of an un-managed OS.

Signed-off-by: Alexandru Costache <alexandru@balena.io>
Change-type: patch
  • Loading branch information
acostach committed Oct 23, 2024
1 parent 95f1922 commit e80722f
Show file tree
Hide file tree
Showing 8 changed files with 518 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/suites/os/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,12 @@ module.exports = {
'./tests/secureboot',
'./tests/device-specific-tests/beaglebone-black',
'./tests/device-specific-tests/243390-rpi3',
'./tests/device-specific-tests/jetson-agx-orin-devkit',
'./tests/device-specific-tests/jetson-agx-orin-devkit-64gb',
'./tests/device-specific-tests/jetson-orin-nano-devkit-nvme',
'./tests/device-specific-tests/jetson-orin-nano-seeed-j3010',
'./tests/device-specific-tests/jetson-orin-nx-seeed-j4012',
'./tests/device-specific-tests/jetson-orin-nx-xavier-nx-devkit',
'./tests/overlap_test/',
'./tests/fingerprint',
'./tests/fsck',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const fs = require('fs');

module.exports = {
deviceType: {
type: 'object',
required: ['slug'],
properties: {
slug: {
type: 'string',
const: 'jetson-agx-orin-devkit-64gb',
},
},
},
title: 'jetson-agx-orin-devkit-64gb - power mode and fan profile tests',
run: async function(test) {
const testHelpers = fs
.readFileSync(`${__dirname}/../orin-assets/power-fan-helpers.sh`)
.toString();

let output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} test_fan_profile`,
this.link,
);

test.is(
output.includes('passed'),
true,
'Fan profile test passed',
);

output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} set_power_mode`,
this.link,
);

test.is(
output.includes('set'),
true,
'Power mode was set',
);

await this.worker.rebootDut(this.link);

await this.utils.waitUntil(
async () => {
output = await this.context.get().worker.executeCommandInHostOS(`${testHelpers} test_power_mode`, this.link);
return output.includes('passed');
},
true,
10,
5 * 1000
);

test.is(output.includes('passed'), true, 'Power mode test passed');
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const fs = require('fs');

module.exports = {
deviceType: {
type: 'object',
required: ['slug'],
properties: {
slug: {
type: 'string',
const: 'jetson-agx-orin-devkit',
},
},
},
title: 'jetson-agx-orin-devkit - power mode and fan profile tests',
run: async function(test) {
const testHelpers = fs
.readFileSync(`${__dirname}/../orin-assets/power-fan-helpers.sh`)
.toString();

let output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} test_fan_profile`,
this.link,
);

test.is(
output.includes('passed'),
true,
'Fan profile test passed',
);

output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} set_power_mode`,
this.link,
);

test.is(
output.includes('set'),
true,
'Power mode was set',
);

await this.worker.rebootDut(this.link);

await this.utils.waitUntil(
async () => {
output = await this.context.get().worker.executeCommandInHostOS(`${testHelpers} test_power_mode`, this.link);
return output.includes('passed');
},
true,
10,
5 * 1000
);

test.is(output.includes('passed'), true, 'Power mode test passed');
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const fs = require('fs');

module.exports = {
deviceType: {
type: 'object',
required: ['slug'],
properties: {
slug: {
type: 'string',
const: 'jetson-orin-nano-devkit-nvme',
},
},
},
title: 'jetson-orin-nano-devkit-nvme - power mode and fan profile tests',
run: async function(test) {
const testHelpers = fs
.readFileSync(`${__dirname}/../orin-assets/power-fan-helpers.sh`)
.toString();

let output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} test_fan_profile`,
this.link,
);

test.is(
output.includes('passed'),
true,
'Fan profile test passed',
);

output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} set_power_mode`,
this.link,
);

test.is(
output.includes('set'),
true,
'Power mode was set',
);

await this.worker.rebootDut(this.link);

await this.utils.waitUntil(
async () => {
output = await this.context.get().worker.executeCommandInHostOS(`${testHelpers} test_power_mode`, this.link);
return output.includes('passed');
},
true,
10,
5 * 1000
);

test.is(output.includes('passed'), true, 'Power mode test passed');
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const fs = require('fs');

module.exports = {
deviceType: {
type: 'object',
required: ['slug'],
properties: {
slug: {
type: 'string',
const: 'jetson-orin-nano-seeed-j3010',
},
},
},
title: 'jetson-orin-nano-seeed-j3010 - power mode and fan profile tests',
run: async function(test) {
const testHelpers = fs
.readFileSync(`${__dirname}/../orin-assets/power-fan-helpers.sh`)
.toString();

let output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} test_fan_profile`,
this.link,
);

test.is(
output.includes('passed'),
true,
'Fan profile test passed',
);

output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} set_power_mode`,
this.link,
);

test.is(
output.includes('set'),
true,
'Power mode was set',
);

await this.worker.rebootDut(this.link);

await this.utils.waitUntil(
async () => {
output = await this.context.get().worker.executeCommandInHostOS(`${testHelpers} test_power_mode`, this.link);
return output.includes('passed');
},
true,
10,
5 * 1000
);

test.is(output.includes('passed'), true, 'Power mode test passed');
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const fs = require('fs');

module.exports = {
deviceType: {
type: 'object',
required: ['slug'],
properties: {
slug: {
type: 'string',
const: 'jetson-orin-nx-seeed-j4012',
},
},
},
title: 'jetson-orin-nx-seeed-j4012 - power mode and fan profile tests',
run: async function(test) {
const testHelpers = fs
.readFileSync(`${__dirname}/../orin-assets/power-fan-helpers.sh`)
.toString();

let output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} test_fan_profile`,
this.link,
);

test.is(
output.includes('passed'),
true,
'Fan profile test passed',
);

output = await this.context
.get()
.worker.executeCommandInHostOS(
`${testHelpers} set_power_mode`,
this.link,
);

test.is(
output.includes('set'),
true,
'Power mode was set',
);

await this.worker.rebootDut(this.link);

await this.utils.waitUntil(
async () => {
output = await this.context.get().worker.executeCommandInHostOS(`${testHelpers} test_power_mode`, this.link);
return output.includes('passed');
},
true,
10,
5 * 1000
);

test.is(output.includes('passed'), true, 'Power mode test passed');
},
};
Loading

0 comments on commit e80722f

Please sign in to comment.