hooks: Add automated testing of Jetson TK1 on swarren-lx1
This required creating a phidgets relay controller app. The Python app previously used on EIMT uses libraries that don't seem to be available any more (they've been replaced by a newer version), so write the control app in C to minimize the amount of non-distro cruft that must be installed. Signed-off-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
committed by
Simon Glass
parent
7d19468b63
commit
f36e6f39e7
37
test/hooks/bin/poweroff.phidgets
Normal file
37
test/hooks/bin/poweroff.phidgets
Normal file
@@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
export LD_LIBRARY_PATH="${phidgets_dir}/lib:${LD_LIBRARY_PATH}"
|
||||
|
||||
# Put board into recovery so it doesn't boot
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_recovery} 1
|
||||
sleep 0.25
|
||||
# Pulse power button to ensure board is on
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_power} 1
|
||||
sleep 0.75
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_power} 0
|
||||
sleep 0.25
|
||||
# Hold power button to turn board off
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_power} 1
|
||||
sleep 15
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_power} 0
|
||||
sleep 0.25
|
||||
# Release recovery
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_recovery} 0
|
||||
32
test/hooks/bin/poweron.phidgets
Normal file
32
test/hooks/bin/poweron.phidgets
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
export LD_LIBRARY_PATH="${phidgets_dir}/lib:${LD_LIBRARY_PATH}"
|
||||
|
||||
# Put board into recovery so it doesn't boot
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_recovery} 1
|
||||
sleep 0.25
|
||||
# Pulse power button to turn board on
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_power} 1
|
||||
sleep 0.75
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_power} 0
|
||||
sleep 0.25
|
||||
# Release recovery
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_recovery} 0
|
||||
29
test/hooks/bin/recovery.phidgets
Normal file
29
test/hooks/bin/recovery.phidgets
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
export LD_LIBRARY_PATH="${phidgets_dir}/lib:${LD_LIBRARY_PATH}"
|
||||
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_recovery} 1
|
||||
sleep 0.25
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_reset} 1
|
||||
sleep 0.25
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_reset} 0
|
||||
sleep 0.25
|
||||
"${phidgets_dir}/bin/phidgets-relay" ${phidgets_serial} ${phidgets_relay_recovery} 0
|
||||
@@ -19,13 +19,18 @@
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
console_dev=/dev/ttyS0
|
||||
power_impl=manual
|
||||
power_impl=phidgets
|
||||
flash_impl=none
|
||||
reset_impl=recovery_download
|
||||
recovery_impl=manual
|
||||
recovery_impl=phidgets
|
||||
phidgets_dir="${HOME}/phidgets"
|
||||
phidgets_serial=109237
|
||||
phidgets_relay_power=0
|
||||
phidgets_relay_recovery=1
|
||||
phidgets_relay_reset=2
|
||||
board_usb_dev=/dev/usbdev-jetson-tk1
|
||||
download_impl=tegra-uboot-flasher
|
||||
tubf_bin="${HOME}/shared/git_wa/tegra-uboot-flasher/scripts"
|
||||
tubf_bin="${HOME}/ubtest-tegra-uboot-flasher/scripts"
|
||||
tubf_board=jetson-tk1
|
||||
tubf_config=jetson-tk1
|
||||
board_usb_port_path=3-10.3
|
||||
board_usb_port_path=3-2.3
|
||||
|
||||
@@ -26,21 +26,21 @@ env__usb_dev_ports = (
|
||||
{
|
||||
"fixture_id": "micro_b",
|
||||
"tgt_usb_ctlr": "0",
|
||||
"host_ums_dev_node": "/dev/disk/by-path/pci-0000:00:14.0-usb-0:10.3:1.0-scsi-0:0:0:0",
|
||||
"host_ums_dev_node": "/dev/disk/by-path/pci-0000:00:14.0-usb-0:2.3:1.0-scsi-0:0:0:0",
|
||||
"host_usb_dev_node": "/dev/usbdev-jetson-tk1",
|
||||
"host_usb_port_path": "3-10.3",
|
||||
"host_usb_port_path": "3-2.3",
|
||||
},
|
||||
)
|
||||
|
||||
env__block_devs = (
|
||||
## SD card; present since I plugged one in
|
||||
#{
|
||||
# "fixture_id": "sd",
|
||||
# "type": "mmc",
|
||||
# "id": "1",
|
||||
# "writable_fs_partition": 1,
|
||||
# "writable_fs_subdir": "tmp/",
|
||||
#},
|
||||
# SD card; present since I plugged one in
|
||||
{
|
||||
"fixture_id": "sd",
|
||||
"type": "mmc",
|
||||
"id": "1",
|
||||
"writable_fs_partition": 1,
|
||||
"writable_fs_subdir": "tmp/",
|
||||
},
|
||||
# eMMC; always present
|
||||
{
|
||||
"fixture_id": "emmc",
|
||||
@@ -50,43 +50,42 @@ env__block_devs = (
|
||||
)
|
||||
|
||||
env__dfu_configs = (
|
||||
# # SD card, partition 1, ext4 filesystem
|
||||
# {
|
||||
# "fixture_id": "sd_fs",
|
||||
# "alt_info": "/dfu_test.bin ext4 1 1;/dfu_dummy.bin ext4 1 1",
|
||||
# "cmd_params": "mmc 1",
|
||||
# "test_sizes": (
|
||||
# 64 - 1,
|
||||
# 64,
|
||||
# 64 + 1,
|
||||
# 4096 - 1,
|
||||
# ),
|
||||
# },
|
||||
# # SD card, partition 3, partition
|
||||
# {
|
||||
# "fixture_id": "sd_part",
|
||||
# "alt_info": "/dfu_test.bin part 1 3;/dfu_dummy.bin ext4 1 1",
|
||||
# "cmd_params": "mmc 1",
|
||||
# "test_sizes": (
|
||||
# 128 - 1,
|
||||
# 128,
|
||||
# 128 + 1,
|
||||
# 4096,
|
||||
# ),
|
||||
# },
|
||||
# # SD card, partition 3, raw device (location overlays partition 3)
|
||||
# {
|
||||
# "fixture_id": "sd_raw",
|
||||
# "alt_info": "/dfu_test.bin raw 4196352 18432;/dfu_dummy.bin ext4 1 1", # triggers bug
|
||||
## "alt_info": "/dfu_test.bin raw 4196352 18432;/dfu_test.bin raw 4196352 18432", # works OK
|
||||
# "cmd_params": "mmc 1",
|
||||
# "test_sizes": (
|
||||
## 960 - 1,
|
||||
# 960,
|
||||
## 960 + 1,
|
||||
## 4096 + 1,
|
||||
# ),
|
||||
# },
|
||||
# SD card, partition 1, ext4 filesystem
|
||||
{
|
||||
"fixture_id": "sd_fs",
|
||||
"alt_info": "/dfu_test.bin ext4 1 1;/dfu_dummy.bin ext4 1 1",
|
||||
"cmd_params": "mmc 1",
|
||||
"test_sizes": (
|
||||
64 - 1,
|
||||
64,
|
||||
64 + 1,
|
||||
4096 - 1,
|
||||
),
|
||||
},
|
||||
# SD card, partition 3, partition
|
||||
{
|
||||
"fixture_id": "sd_part",
|
||||
"alt_info": "/dfu_test.bin part 1 3;/dfu_dummy.bin ext4 1 1",
|
||||
"cmd_params": "mmc 1",
|
||||
"test_sizes": (
|
||||
128 - 1,
|
||||
128,
|
||||
128 + 1,
|
||||
4096,
|
||||
),
|
||||
},
|
||||
# SD card, partition 3, raw device (location overlays partition 3)
|
||||
{
|
||||
"fixture_id": "sd_raw",
|
||||
"alt_info": "/dfu_test.bin raw 4196352 18432;/dfu_dummy.bin ext4 1 1",
|
||||
"cmd_params": "mmc 1",
|
||||
"test_sizes": (
|
||||
960 - 1,
|
||||
960,
|
||||
960 + 1,
|
||||
4096 + 1,
|
||||
),
|
||||
},
|
||||
# RAM
|
||||
{
|
||||
"fixture_id": "ram",
|
||||
|
||||
1
test/hooks/src/.gitignore
vendored
Normal file
1
test/hooks/src/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
phidgets-relay
|
||||
13
test/hooks/src/README.txt
Normal file
13
test/hooks/src/README.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
# Don't use libphidgets22 since it's stupid and resets the state of all outputs
|
||||
# on open and close.
|
||||
wget https://www.phidgets.com/downloads/phidget21/libraries/linux/libphidget/libphidget_2.1.8.20170607.tar.gz
|
||||
tar xf libphidget_2.1.8.20170607.tar.gz
|
||||
cd libphidget-2.1.8.20170607
|
||||
./configure --prefix="${HOME}/phidgets"
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
./build.sh
|
||||
mkdir "${HOME}/phidgets/bin"
|
||||
cp phidgets-relay "${HOME}/phidgets/bin"
|
||||
LD_LIBRARY_PATH="${HOME}/phidgets/lib" "${HOME}/phidgets/bin/phidgets-relay" 109237 2 1
|
||||
7
test/hooks/src/build.sh
Executable file
7
test/hooks/src/build.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
gcc -o phidgets-relay \
|
||||
-I "${HOME}/phidgets/include" \
|
||||
phidgets-relay.c \
|
||||
-L "${HOME}/phidgets/lib" -lphidget21 \
|
||||
-lusb-1.0 -lpthread -ldl -lm
|
||||
81
test/hooks/src/phidgets-relay.c
Normal file
81
test/hooks/src/phidgets-relay.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <phidget21.h>
|
||||
|
||||
static void usage(const char *appname) {
|
||||
fprintf(stderr, "usage: %s serial relay_id value\n", appname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void phidgets_error(const char *func, int err) {
|
||||
int err2;
|
||||
const char* error;
|
||||
|
||||
fprintf(stderr, "%s() failed:\n", func);
|
||||
err2 = CPhidget_getErrorDescription(err, &error);
|
||||
if (err != EPHIDGET_OK) {
|
||||
fprintf(stderr, "\tPCPhidget_getErrorDescription() failed: %d\n", err2);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\t%s\n", error);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int serial, relay_id, value, err;
|
||||
CPhidgetInterfaceKitHandle ifk;
|
||||
|
||||
if (argc != 4)
|
||||
usage(argv[0]);
|
||||
|
||||
serial = atoi(argv[1]);
|
||||
relay_id = atoi(argv[2]);
|
||||
value = atoi(argv[3]);
|
||||
|
||||
err = CPhidget_enableLogging(PHIDGET_LOG_VERBOSE, NULL);
|
||||
if (err != EPHIDGET_OK)
|
||||
phidgets_error("CPhidget_enableLogging", err);
|
||||
err = CPhidgetInterfaceKit_create(&ifk);
|
||||
if (err != EPHIDGET_OK)
|
||||
phidgets_error("CPhidgetInterfaceKit_create", err);
|
||||
err = CPhidget_open((CPhidgetHandle)ifk, serial);
|
||||
if (err != EPHIDGET_OK)
|
||||
phidgets_error("CPhidget_open", err);
|
||||
err = CPhidget_waitForAttachment((CPhidgetHandle)ifk, 0);
|
||||
if (err != EPHIDGET_OK)
|
||||
phidgets_error("CPhidget_waitForAttachment", err);
|
||||
err = CPhidgetInterfaceKit_setOutputState(ifk, relay_id, value);
|
||||
if (err != EPHIDGET_OK)
|
||||
phidgets_error("CPhidgetInterfaceKit_setOutputState", err);
|
||||
err = CPhidget_close((CPhidgetHandle)ifk);
|
||||
if (err != EPHIDGET_OK)
|
||||
phidgets_error("CPhidget_close", err);
|
||||
err = CPhidget_delete((CPhidgetHandle)ifk);
|
||||
if (err != EPHIDGET_OK)
|
||||
phidgets_error("CPhidget_delete", err);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -25,8 +25,10 @@
|
||||
# Jetson TK1 (PM375)
|
||||
# Serial console
|
||||
ACTION=="add", KERNELS=="ttyS0", ENV{UBTEST_DEVICE}="1"
|
||||
# Phidgets control board
|
||||
ACTION=="add", SUBSYSTEMS=="usb", DRIVER=="usb", KERNELS=="3-2.7", ENV{UBTEST_DEVICE}="1", SYMLINK+="phidgets-jetson-tk1"
|
||||
# Device-mode port
|
||||
ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="3-10.3", ENV{UBTEST_DEVICE}="1", SYMLINK+="usbdev-jetson-tk1"
|
||||
ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="3-2.3", ENV{UBTEST_DEVICE}="1", SYMLINK+="usbdev-jetson-tk1"
|
||||
|
||||
# Jetson TX1 (P2371-2180)
|
||||
# PM342 debug board
|
||||
@@ -34,6 +36,12 @@ ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="3-6", ENV{UBTEST_DEVICE}="1"
|
||||
# Device-mode port
|
||||
ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="3-13", ENV{UBTEST_DEVICE}="1", SYMLINK+="usbdev-p2371-2180"
|
||||
|
||||
# Jetson TX2 (P2771-0000)
|
||||
# PM342 debug board
|
||||
ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="3-14", ENV{UBTEST_DEVICE}="1"
|
||||
# Device-mode port
|
||||
ACTION=="add", SUBSYSTEMS=="usb", KERNELS=="3-1", ENV{UBTEST_DEVICE}="1", SYMLINK+="usbdev-p2771-0000"
|
||||
|
||||
# NVIDIA's PM342 control scripts search for devices with matching USB vendor
|
||||
# and device ID, then check each to verify if it matches the requested serial
|
||||
# number. If a USB device node isn't r/w for the user running the script,
|
||||
|
||||
Reference in New Issue
Block a user