Skip to content

Commit

Permalink
fix: get testing again
Browse files Browse the repository at this point in the history
Did a bunch of work to get everything testing again properly. Add
various updates to dependencies and build fixes. Add a few convenience
flags for faster testing on already flashed boards. Add debugging
information to report exact pin errors during tests. Made all parts
fully compatible with running on Linux systems, instead of some parts
working on darwin and some parts working on linux.

There are still some parts that need to be reworked to not break on
updates but for now, it should be suitable to just have some paths
updated manually whenever updating esp-idf, etc.
  • Loading branch information
gary-kim committed Apr 3, 2024
1 parent 6793557 commit 51b236f
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 97 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/fw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- id: skip_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1

build:
needs: pre_job
Expand All @@ -20,36 +20,21 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache build/
id: cache-build-dir
uses: actions/cache@v3
with:
path: build
key: build_cache

- name: Cache deps/
id: cache-deps-dir
uses: actions/cache@v3
with:
path: deps
key: deps_cache

- name: Cache .sconsign.dblite
id: cache-sconsign
uses: actions/cache@v3
with:
path: .sconsign.dblite
key: sconsign_cache

- name: Set up Python
run: |
sudo apt-get update -yqq
sudo apt-get install python3 python3-pip python3-venv -yqq
- name: Get x86 libraries
run: sudo apt-get install gcc-multilib -yqq

- name: Install PlatformIO
run: sudo pip install --upgrade platformio

- name: Install scons
run: pip install scons

Expand All @@ -63,7 +48,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: can-dbc
path: build/can/fsae_can.dbc
path: build/can/eol_can.dbc

- name: Upload OpenCAN Codegen Artifacts
uses: actions/upload-artifact@v3
Expand Down
8 changes: 4 additions & 4 deletions dependencies.SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import os
Import("env")

# VERSIONS ------------------------------------------------
env['ESP_RUST_VERSION'] = '1.69.0.0'
env['RUST_VERSION'] = '1.68.2'
env['ESP_RUST_VERSION'] = '1.70.0.0'
env['RUST_VERSION'] = '1.70.0'
env['OPENCAN_VERSION'] = 'b014266'
# ---------------------------------------------------------

Expand Down Expand Up @@ -87,7 +87,7 @@ env['ESPUP'] = RUST_TOOLS_PATH.File('espup')
espup_install_builder = env.Command(
env['ESPUP'],
env['CARGO'],
'$CARGO install espup'
'$CARGO install espup@0.8.0 --locked'
)

ESP_RUST_PATH = env.Dir(env['ENV']['RUSTUP_HOME']).Dir('toolchains/espr')
Expand All @@ -104,7 +104,7 @@ esp_rust_install_builder = env.Command(
# Update these as needed from esp-env.sh
env.PrependENVPath('PATH', ESP_RUST_PATH.Dir('xtensa-esp32s3-elf/esp-2021r2-patch5-8_4_0/xtensa-esp32s3-elf/bin'))
env.PrependENVPath('PATH', ESP_RUST_PATH.Dir('riscv32-esp-elf/esp-2021r2-patch5-8_4_0/riscv32-esp-elf/bin'))
env['ENV']['LIBCLANG_PATH'] = ESP_RUST_PATH.Dir('xtensa-esp32-elf-clang/esp-15.0.0-20221201/esp-clang/lib').abspath
env['ENV']['LIBCLANG_PATH'] = ESP_RUST_PATH.Dir('xtensa-esp32-elf-clang/esp-16.0.0-20230516/esp-clang/lib').abspath

env.Alias('deps-esp-rust', esp_rust_install_builder)
# ---------------------------------------------------------
Expand Down
18 changes: 17 additions & 1 deletion eoltest/src/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,30 @@ impl EolTest {
continue;
};

#[cfg(target_os = "macos")]
let normalized_dev_name = dev.port_name.replace("tty.usb", "cu.usb");
#[cfg(target_os = "linux")]
let normalized_dev_name = dev.port_name.clone();

#[cfg(target_os = "macos")]
let normalized_tester_name =
self.tester.name().unwrap().replace("tty.usb", "cu.usb");
#[cfg(target_os = "linux")]
let normalized_tester_name = self.tester.name().unwrap();

if normalized_dev_name == normalized_tester_name {
continue; // skip the tester
}

if product == "USB JTAG_serial debug unit" {
#[cfg(target_os = "macos")]
let expected_product_name = "USB JTAG_serial debug unit";

#[cfg(target_os = "linux")]
let expected_product_name = "USB_JTAG_serial_debug_unit";

debug!("checking device with product name ${product}");

if product == expected_product_name {
return Ok(dev.port_name);
}
}
Expand Down
17 changes: 9 additions & 8 deletions eoltest/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::Parser;
use clap::{ArgAction, Parser};
use serde::Serialize;
use serialport::SerialPort;
use tracing::{error, info, warn, Level};
Expand All @@ -7,8 +7,6 @@ use tracing_subscriber::FmtSubscriber;
use std::{
fs::{self},
process::exit,
thread::sleep,
time::Duration,
};

mod esp32;
Expand All @@ -23,10 +21,12 @@ cfg_if::cfg_if! {

#[derive(clap::Parser)]
struct Args {
#[clap(long)]
#[clap(long, short)]
tester_port: String,
#[clap(long)]
serial_number: String,
#[clap(long, short, action=ArgAction::SetTrue)]
skip_flashing: bool,
}

struct EolTest {
Expand Down Expand Up @@ -59,10 +59,11 @@ impl EolTest {
#[cfg(target_os = "macos")]
let mut eol = EolTest { tester };

eol.prepare_esp32();

info!("Waiting for 5 seconds...");
sleep(Duration::from_secs(5));
if args.skip_flashing {
info!("Skip flashing DUT");
} else {
eol.prepare_esp32();
}

let results = loop {
match eol.get_test_result() {
Expand Down
4 changes: 4 additions & 0 deletions eoltest/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use anyhow::Result;
use eol_shared::{TestResults, TEST_RESULT_START_MAGIC};

use crate::EolTest;
use tracing::debug;

#[derive(Debug, thiserror::Error)]
pub enum Error {
Expand All @@ -33,6 +34,9 @@ impl EolTest {
let mut line = String::new();

reader.read_line(&mut line).ok();
if line != "" {
debug!("DUT: {line}");
}
if let Some(results) = line.strip_prefix(TEST_RESULT_START_MAGIC) {
if !got_first {
// skip the first result
Expand Down
Loading

0 comments on commit 51b236f

Please sign in to comment.