-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/os: Add Jetson Orin device-specific fan and power mode smoke tests
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
Showing
8 changed files
with
518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
tests/suites/os/tests/device-specific-tests/jetson-agx-orin-devkit-64gb/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}, | ||
}; |
74 changes: 74 additions & 0 deletions
74
tests/suites/os/tests/device-specific-tests/jetson-agx-orin-devkit/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}, | ||
}; |
74 changes: 74 additions & 0 deletions
74
tests/suites/os/tests/device-specific-tests/jetson-orin-nano-devkit-nvme/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}, | ||
}; |
74 changes: 74 additions & 0 deletions
74
tests/suites/os/tests/device-specific-tests/jetson-orin-nano-seeed-j3010/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}, | ||
}; |
74 changes: 74 additions & 0 deletions
74
tests/suites/os/tests/device-specific-tests/jetson-orin-nx-seeed-j4012/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}, | ||
}; |
Oops, something went wrong.