Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remote tests. #126

Merged
merged 24 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
61 changes: 61 additions & 0 deletions .github/workflows/regression_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: USBX Regression Test

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
inputs:
tests_to_run:
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'
required: false
default: 'default_build_coverage'
skip_coverage:
required: false
type: boolean
default: false
coverage_name:
required: false
default: 'default_build_coverage'
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

manual_tests:
if: github.event_name == 'workflow_dispatch'
permissions:
contents: read
issues: read
checks: write
pull-requests: write
pages: write
id-token: write

uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
with:
cmake_path: ./test/cmake/usbx
build_script: ./scripts/build.sh ${{ inputs.tests_to_run }}
test_script: ./scripts/test.sh ${{ inputs.tests_to_run }}
coverage_name: ${{ inputs.coverage_name }}
skip_coverage: ${{ !!inputs.skip_coverage }}

auto_tests:
if: github.event_name != 'workflow_dispatch'
permissions:
contents: read
issues: read
checks: write
pull-requests: write
pages: write
id-token: write

uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
with:
cmake_path: ./test/cmake/usbx
build_script: ./scripts/build.sh default_build_coverage
test_script: ./scripts/test.sh default_build_coverage
coverage_name: default_build_coverage
skip_coverage: false
2 changes: 2 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
$(dirname `realpath $0`)/../test/cmake/usbx/run.sh build $@
25 changes: 25 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#
# Install necessary softwares for Ubuntu.

sudo apt-get update
sudo apt-get install -y \
gcc-multilib \
git \
g++ \
python3-pip \
ninja-build \
unifdef \
p7zip-full \
tofrodos \
gawk \
software-properties-common

wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
CODENAME=$(lsb_release -c | cut -f2 -d':' | sed 's/\t//')
sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ $CODENAME main"
sudo apt-get -y install cmake

python3 -m pip install --upgrade pip
pip3 install gcovr==4.1
pip3 install --upgrade cmake
2 changes: 2 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
CTEST_PARALLEL_LEVEL=4 $(dirname `realpath $0`)/../test/cmake/usbx/run.sh test $@
37 changes: 37 additions & 0 deletions test/cmake/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

project(libs LANGUAGES C)

if($ENV{ENABLE_64})
message(STATUS "Building for 64bit")
set(NX_USER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/nx_user.h)
else()
add_compile_options(-m32)
add_link_options(-m32)
message(STATUS "Building for 32bit")
endif()
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")

get_filename_component(externals ${CMAKE_CURRENT_SOURCE_DIR}/../../../externals
ABSOLUTE)
add_subdirectory(${externals}/threadx threadx)
add_subdirectory(${externals}/netxduo netxduo)
add_subdirectory(${externals}/filex filex)
target_compile_options(threadx PRIVATE -DTX_ENABLE_EVENT_TRACE)
if(NOT DEFINED ENV{ENABLE_IDLE})
target_compile_options(threadx PRIVATE -DTX_LINUX_NO_IDLE_ENABLE)
endif()
target_compile_options(filex PRIVATE -DFX_ENABLE_EXFAT)

target_compile_options(netxduo PRIVATE -DTX_ENABLE_EVENT_TRACE -DNX_PHYSICAL_HEADER=20)

foreach(lib threadx netxduo filex)
get_target_property(dirs ${lib} INCLUDE_DIRECTORIES)
execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/inc)
foreach(dir ${dirs})
file(GLOB header_files ${dir}/*.h)
foreach(header_file ${header_files})
execute_process(COMMAND ln -sf ${header_file} ${CMAKE_BINARY_DIR}/inc)
endforeach()
endforeach()
endforeach()
87 changes: 87 additions & 0 deletions test/cmake/libs/nx_user.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/


/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** User Specific */
/** */
/**************************************************************************/
/**************************************************************************/


/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_user.h PORTABLE C */
/* 6.0 */
/* */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains user defines for configuring NetX in specific */
/* ways. This file will have an effect only if the application and */
/* NetX library are built with NX_INCLUDE_USER_DEFINE_FILE defined. */
/* Note that all the defines in this file may also be made on the */
/* command line when building NetX library and application objects. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* */
/**************************************************************************/

#ifndef NX_USER_H
#define NX_USER_H

/* Define the extension to hold the control block for 64-bit mode. */
#define NX_THREAD_EXTENSION_PTR_SET(a, b) { \
TX_THREAD *thread_ptr; \
thread_ptr = (TX_THREAD *) (a); \
(thread_ptr -> tx_thread_extension_ptr) = (VOID *)(b); \
}
#define NX_THREAD_EXTENSION_PTR_GET(a, b, c) { \
NX_PARAMETER_NOT_USED(c); \
TX_THREAD *thread_ptr; \
thread_ptr = tx_thread_identify(); \
while(1)\
{ \
if (thread_ptr -> tx_thread_extension_ptr) \
{ \
(a) = (b *)(thread_ptr -> tx_thread_extension_ptr); \
break; \
} \
tx_thread_sleep(1); \
} \
}
#define NX_TIMER_EXTENSION_PTR_SET(a, b) { \
TX_TIMER *timer_ptr; \
timer_ptr = (TX_TIMER *) (a); \
(timer_ptr -> tx_timer_internal.tx_timer_internal_extension_ptr) = (VOID *)(b); \
}
#define NX_TIMER_EXTENSION_PTR_GET(a, b, c) { \
NX_PARAMETER_NOT_USED(c); \
if (!_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr) \
return; \
(a) = (b *)(_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr); \
}

#endif

Loading