Skip to content

Commit 6ed7092

Browse files
authored
Add regression tests. (#126)
Add regression tests (auto triggered on PR, manually triggered in forked branch).
1 parent 26585e4 commit 6ed7092

549 files changed

Lines changed: 287858 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: USBX Regression Test
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the master branch
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
tests_to_run:
9+
description: 'all, single or multiple of default_build_coverage error_check_build_full_coverage tracex_enable_build device_buffer_owner_build device_zero_copy_build nofx_build_coverage optimized_build standalone_device_build_coverage standalone_device_buffer_owner_build standalone_device_zero_copy_build standalone_host_build_coverage standalone_build_coverage generic_build otg_support_build memory_management_build_coverage msrc_rtos_build msrc_standalone_build'
10+
required: false
11+
default: 'default_build_coverage'
12+
skip_coverage:
13+
required: false
14+
type: boolean
15+
default: false
16+
coverage_name:
17+
required: false
18+
default: 'default_build_coverage'
19+
push:
20+
branches: [ master ]
21+
pull_request:
22+
branches: [ master ]
23+
24+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
25+
jobs:
26+
27+
manual_tests:
28+
if: github.event_name == 'workflow_dispatch'
29+
permissions:
30+
contents: read
31+
issues: read
32+
checks: write
33+
pull-requests: write
34+
pages: write
35+
id-token: write
36+
37+
uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
38+
with:
39+
cmake_path: ./test/cmake/usbx
40+
build_script: ./scripts/build.sh ${{ inputs.tests_to_run }}
41+
test_script: ./scripts/test.sh ${{ inputs.tests_to_run }}
42+
coverage_name: ${{ inputs.coverage_name }}
43+
skip_coverage: ${{ !!inputs.skip_coverage }}
44+
45+
auto_tests:
46+
if: github.event_name != 'workflow_dispatch'
47+
permissions:
48+
contents: read
49+
issues: read
50+
checks: write
51+
pull-requests: write
52+
pages: write
53+
id-token: write
54+
55+
uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
56+
with:
57+
cmake_path: ./test/cmake/usbx
58+
build_script: ./scripts/build.sh default_build_coverage
59+
test_script: ./scripts/test.sh default_build_coverage
60+
coverage_name: default_build_coverage
61+
skip_coverage: false

scripts/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
$(dirname `realpath $0`)/../test/cmake/usbx/run.sh build $@

scripts/install.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
#
3+
# Install necessary softwares for Ubuntu.
4+
5+
sudo apt-get update
6+
sudo apt-get install -y \
7+
gcc-multilib \
8+
git \
9+
g++ \
10+
python3-pip \
11+
ninja-build \
12+
unifdef \
13+
p7zip-full \
14+
tofrodos \
15+
gawk \
16+
software-properties-common
17+
18+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
19+
CODENAME=$(lsb_release -c | cut -f2 -d':' | sed 's/\t//')
20+
sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ $CODENAME main"
21+
sudo apt-get -y install cmake
22+
23+
python3 -m pip install --upgrade pip
24+
pip3 install gcovr==4.1
25+
pip3 install --upgrade cmake

scripts/test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
CTEST_PARALLEL_LEVEL=4 $(dirname `realpath $0`)/../test/cmake/usbx/run.sh test $@

test/cmake/libs/CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
2+
3+
project(libs LANGUAGES C)
4+
5+
if($ENV{ENABLE_64})
6+
message(STATUS "Building for 64bit")
7+
set(NX_USER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/nx_user.h)
8+
else()
9+
add_compile_options(-m32)
10+
add_link_options(-m32)
11+
message(STATUS "Building for 32bit")
12+
endif()
13+
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
14+
15+
get_filename_component(externals ${CMAKE_CURRENT_SOURCE_DIR}/../../../externals
16+
ABSOLUTE)
17+
add_subdirectory(${externals}/threadx threadx)
18+
add_subdirectory(${externals}/netxduo netxduo)
19+
add_subdirectory(${externals}/filex filex)
20+
target_compile_options(threadx PRIVATE -DTX_ENABLE_EVENT_TRACE)
21+
if(NOT DEFINED ENV{ENABLE_IDLE})
22+
target_compile_options(threadx PRIVATE -DTX_LINUX_NO_IDLE_ENABLE)
23+
endif()
24+
target_compile_options(filex PRIVATE -DFX_ENABLE_EXFAT)
25+
26+
target_compile_options(netxduo PRIVATE -DTX_ENABLE_EVENT_TRACE -DNX_PHYSICAL_HEADER=20)
27+
28+
foreach(lib threadx netxduo filex)
29+
get_target_property(dirs ${lib} INCLUDE_DIRECTORIES)
30+
execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/inc)
31+
foreach(dir ${dirs})
32+
file(GLOB header_files ${dir}/*.h)
33+
foreach(header_file ${header_files})
34+
execute_process(COMMAND ln -sf ${header_file} ${CMAKE_BINARY_DIR}/inc)
35+
endforeach()
36+
endforeach()
37+
endforeach()

test/cmake/libs/nx_user.h

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**************************************************************************/
2+
/* */
3+
/* Copyright (c) Microsoft Corporation. All rights reserved. */
4+
/* */
5+
/* This software is licensed under the Microsoft Software License */
6+
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
7+
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8+
/* and in the root directory of this software. */
9+
/* */
10+
/**************************************************************************/
11+
12+
13+
/**************************************************************************/
14+
/**************************************************************************/
15+
/** */
16+
/** NetX Component */
17+
/** */
18+
/** User Specific */
19+
/** */
20+
/**************************************************************************/
21+
/**************************************************************************/
22+
23+
24+
/**************************************************************************/
25+
/* */
26+
/* PORT SPECIFIC C INFORMATION RELEASE */
27+
/* */
28+
/* nx_user.h PORTABLE C */
29+
/* 6.0 */
30+
/* */
31+
/* AUTHOR */
32+
/* */
33+
/* Yuxin Zhou, Microsoft Corporation */
34+
/* */
35+
/* DESCRIPTION */
36+
/* */
37+
/* This file contains user defines for configuring NetX in specific */
38+
/* ways. This file will have an effect only if the application and */
39+
/* NetX library are built with NX_INCLUDE_USER_DEFINE_FILE defined. */
40+
/* Note that all the defines in this file may also be made on the */
41+
/* command line when building NetX library and application objects. */
42+
/* */
43+
/* RELEASE HISTORY */
44+
/* */
45+
/* DATE NAME DESCRIPTION */
46+
/* */
47+
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
48+
/* */
49+
/**************************************************************************/
50+
51+
#ifndef NX_USER_H
52+
#define NX_USER_H
53+
54+
/* Define the extension to hold the control block for 64-bit mode. */
55+
#define NX_THREAD_EXTENSION_PTR_SET(a, b) { \
56+
TX_THREAD *thread_ptr; \
57+
thread_ptr = (TX_THREAD *) (a); \
58+
(thread_ptr -> tx_thread_extension_ptr) = (VOID *)(b); \
59+
}
60+
#define NX_THREAD_EXTENSION_PTR_GET(a, b, c) { \
61+
NX_PARAMETER_NOT_USED(c); \
62+
TX_THREAD *thread_ptr; \
63+
thread_ptr = tx_thread_identify(); \
64+
while(1)\
65+
{ \
66+
if (thread_ptr -> tx_thread_extension_ptr) \
67+
{ \
68+
(a) = (b *)(thread_ptr -> tx_thread_extension_ptr); \
69+
break; \
70+
} \
71+
tx_thread_sleep(1); \
72+
} \
73+
}
74+
#define NX_TIMER_EXTENSION_PTR_SET(a, b) { \
75+
TX_TIMER *timer_ptr; \
76+
timer_ptr = (TX_TIMER *) (a); \
77+
(timer_ptr -> tx_timer_internal.tx_timer_internal_extension_ptr) = (VOID *)(b); \
78+
}
79+
#define NX_TIMER_EXTENSION_PTR_GET(a, b, c) { \
80+
NX_PARAMETER_NOT_USED(c); \
81+
if (!_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr) \
82+
return; \
83+
(a) = (b *)(_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr); \
84+
}
85+
86+
#endif
87+

0 commit comments

Comments
 (0)