blob: 75c9a817883ee9a21e297a4a4f8d53750ad8eac0 [file] [log] [blame]
Eunice Sun0a8d70e2022-09-15 15:42:49 +10001#!/bin/bash
2
3# Copyright 2022 The ChromiumOS Authors.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Runs firmware tests without hardware.
8# This will run for roughly 2.5mins.
9
10RED='\033[0;31m'
11GREEN='\033[0;32m'
12NORMAL='\033[0m'
13
14set -e
15PROJECT_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")"/..)
16
17echo -e "\n\n${RED}=======================================${NORMAL}"
18echo -e "${GREEN}Running Renode tests${NORMAL}"
19echo -e "${RED}=======================================${NORMAL}"
20
21cd "${PROJECT_ROOT}/"
22renode --console renode/hps_stage1_tests.resc &
23renode_PID=$!
24
25{
26 for _ in {1..150}
27 do
28 if ! ps -p "${renode_PID}" >/dev/null
29 then
30 exit 0
31 else
32 sleep 1
33 fi
34 done
35 einfo "Renode process still exists" && kill "${renode_PID}" && exit 0;
36} &
37
38cd "${PROJECT_ROOT}/rust/target/release/"
39sleep 60
40echo "Start hps-factory test at ${PROJECT_ROOT}"
41./hps-factory --socket /tmp/i2c.sock test-stage1
42factory_PID=$!
43
44wait "${factory_PID}"
45status=$?
46[ "${status}" -eq 0 ] && exit 0
47
48echo "Renode test failed"
49exit 1