Skip to content

Commit 487ca45

Browse files
Merge pull request #244 from azure-rtos/tizho/test
Release ThreadX regression system
2 parents ac3b6b3 + 5f430f2 commit 487ca45

File tree

233 files changed

+87402
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+87402
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"image": "tizho/azurertos-regression",
3+
"runArgs": [ "--cap-add=NET_ADMIN"]
4+
}

.pipelines/smp.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
trigger:
2+
- master
3+
4+
pr:
5+
- master
6+
7+
pool:
8+
vmImage: "ubuntu-22.04"
9+
10+
steps:
11+
- bash: sudo $(Build.SourcesDirectory)/scripts/install.sh
12+
displayName: 'Install softwares'
13+
env:
14+
INDEX_URL: $(INDEX_URL)
15+
16+
- task: Bash@3
17+
displayName: 'SDL check'
18+
inputs:
19+
filePath: '$(Build.SourcesDirectory)/scripts/sdl_check.sh'
20+
21+
- task: Bash@3
22+
displayName: 'Build SMP'
23+
inputs:
24+
filePath: '$(Build.SourcesDirectory)/scripts/build_smp.sh'
25+
26+
- task: Bash@3
27+
displayName: 'Test SMP'
28+
inputs:
29+
filePath: '$(Build.SourcesDirectory)/scripts/test_smp.sh'
30+
31+
- task: PublishTestResults@2
32+
condition: succeededOrFailed()
33+
displayName: 'Test SMP (PublishTestResults)'
34+
inputs:
35+
testResultsFormat: 'cTest'
36+
testResultsFiles: '*/Testing/**/*.xml'
37+
searchFolder: '$(Build.SourcesDirectory)/test/smp/cmake/build'
38+
testRunTitle: 'SMP-Tests'
39+
buildConfiguration: 'Release'
40+
41+
- task: CopyFiles@2
42+
condition: succeededOrFailed()
43+
displayName: 'Test SMP (PublishTestReports)'
44+
inputs:
45+
SourceFolder: '$(Build.SourcesDirectory)/test/smp/cmake'
46+
Contents: |
47+
build/*.txt
48+
build/*/Testing/**/*.xml
49+
coverage_report/**/*
50+
TargetFolder: '$(ob_outputDirectory)/test_reports_SMP'
51+
52+
- task: PublishCodeCoverageResults@1
53+
condition: succeededOrFailed()
54+
displayName: 'Test SMP (PublishCodeCoverageResults)'
55+
inputs:
56+
codeCoverageTool: 'Cobertura'
57+
summaryFileLocation: '$(Build.SourcesDirectory)/test/smp/cmake/coverage_report/default_build_coverage.xml'
58+
pathToSources: '$(Build.SourcesDirectory)/test/smp/cmake'
59+
reportDirectory: '$(Build.SourcesDirectory)/test/smp/cmake/coverage_report/default_build_coverage'

.pipelines/tx.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
trigger:
2+
- master
3+
4+
pr:
5+
- master
6+
7+
pool:
8+
vmImage: "ubuntu-22.04"
9+
10+
steps:
11+
- bash: sudo $(Build.SourcesDirectory)/scripts/install.sh
12+
displayName: 'Install softwares'
13+
env:
14+
INDEX_URL: $(INDEX_URL)
15+
16+
- task: Bash@3
17+
displayName: 'SDL check'
18+
inputs:
19+
filePath: '$(Build.SourcesDirectory)/scripts/sdl_check.sh'
20+
21+
- task: Bash@3
22+
displayName: 'Build TX'
23+
inputs:
24+
filePath: '$(Build.SourcesDirectory)/scripts/build_tx.sh'
25+
26+
- task: Bash@3
27+
displayName: 'Test TX'
28+
inputs:
29+
filePath: '$(Build.SourcesDirectory)/scripts/test_tx.sh'
30+
31+
- task: PublishTestResults@2
32+
condition: succeededOrFailed()
33+
displayName: 'Test TX (PublishTestResults)'
34+
inputs:
35+
testResultsFormat: 'cTest'
36+
testResultsFiles: '*/Testing/**/*.xml'
37+
searchFolder: '$(Build.SourcesDirectory)/test/tx/cmake/build'
38+
testRunTitle: 'TX-Tests'
39+
buildConfiguration: 'Release'
40+
41+
- task: CopyFiles@2
42+
condition: succeededOrFailed()
43+
displayName: 'Test TX (PublishTestReports)'
44+
inputs:
45+
SourceFolder: '$(Build.SourcesDirectory)/test/tx/cmake'
46+
Contents: |
47+
build/*.txt
48+
build/*/Testing/**/*.xml
49+
coverage_report/**/*
50+
TargetFolder: '$(ob_outputDirectory)/test_reports_TX'
51+
52+
- task: PublishCodeCoverageResults@1
53+
condition: succeededOrFailed()
54+
displayName: 'Test TX (PublishCodeCoverageResults)'
55+
inputs:
56+
codeCoverageTool: 'Cobertura'
57+
summaryFileLocation: '$(Build.SourcesDirectory)/test/tx/cmake/coverage_report/default_build_coverage.xml'
58+
pathToSources: '$(Build.SourcesDirectory)/test/tx/cmake'
59+
reportDirectory: '$(Build.SourcesDirectory)/test/tx/cmake/coverage_report/default_build_coverage'

scripts/build_smp.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/smp/cmake/run.sh build all

scripts/build_tx.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/tx/cmake/run.sh build all

scripts/cmake_bootstrap.sh

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
function help() {
6+
echo "Usage: $0 [build|test] [all|<build_configuration> <build_configuration>...]"
7+
echo "Available build_configuration:"
8+
for build in ${build_configurations[*]}; do
9+
echo " $build"
10+
done
11+
exit 1
12+
}
13+
14+
function validate() {
15+
for build in ${build_configurations[*]}; do
16+
if [ "$1" == "$build" ]; then
17+
return
18+
fi
19+
done
20+
help
21+
}
22+
23+
function generate() {
24+
build=$1
25+
cmake -Bbuild/$build -GNinja -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=$(dirname $(realpath $0))/../cmake/linux.cmake -DCMAKE_BUILD_TYPE=$build .
26+
}
27+
28+
function build() {
29+
cmake --build build/$1
30+
}
31+
32+
function build_libs() {
33+
cmake -Bbuild/libs -GNinja -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=$(dirname $(realpath $0))/../cmake/linux.cmake libs
34+
cmake --build build/libs
35+
}
36+
37+
function test() {
38+
pushd build/$1
39+
[ -z "${CTEST_PARALLEL_LEVEL}" ] && parallel="-j$2"
40+
if [ -z "${CTEST_REPEAT_FAIL}" ];
41+
then
42+
repeat_fail=2
43+
else
44+
repeat_fail=${CTEST_REPEAT_FAIL}
45+
fi
46+
ctest $parallel --timeout 1000 -O $1.txt -T test --no-compress-output --test-output-size-passed 4194304 --test-output-size-failed 4194304 --output-on-failure --repeat until-pass:${repeat_fail}
47+
popd
48+
grep -E "^(\s*[0-9]+|Total)" build/$1/$1.txt >build/$1.txt
49+
sed -i "s/\x1B\[[0-9;]*[JKmsu]//g" build/$1.txt
50+
if [[ $1 = *"_coverage" ]]; then
51+
./coverage.sh $1
52+
fi
53+
}
54+
55+
cd $(dirname $0)
56+
57+
result=$(sed -n "/(BUILD_CONFIGURATIONS/,/)/p" CMakeLists.txt|sed ':label;N;s/\n/ /;b label'|grep -Pzo "[a-zA-Z0-9_]*build[a-zA-Z0-9_]*\s*"| tr -d '\0')
58+
IFS=' '
59+
read -ra build_configurations <<< "$result"
60+
61+
if [ $# -lt 1 ]; then
62+
help
63+
fi
64+
65+
command=$1
66+
shift
67+
68+
if [ "$#" == "0" ]; then
69+
builds=${build_configurations[0]}
70+
elif [ "$*" == "all" ]; then
71+
builds=${build_configurations[@]}
72+
else
73+
for item in $*; do
74+
validate $item
75+
done
76+
builds=$*
77+
fi
78+
79+
if [ "$command" == "build" ]; then
80+
for item in $builds; do
81+
generate $item
82+
echo ""
83+
done
84+
85+
for item in $builds; do
86+
echo "Building $item"
87+
build $item
88+
echo ""
89+
done
90+
elif [ "$command" == "test" ]; then
91+
cores=$(nproc)
92+
if [ -z "${CTEST_PARALLEL_LEVEL}" ];
93+
then
94+
# Run builds in parallel
95+
build_counts=$(echo $builds | wc -w)
96+
parallel_jobs=$(($cores / $build_counts))
97+
parallel_jobs=$(($parallel_jobs + 2))
98+
pids=""
99+
for item in $builds; do
100+
echo "Testing $item"
101+
test $item $parallel_jobs &
102+
pids+=" $!"
103+
done
104+
exit_code=0
105+
for p in $pids; do
106+
wait $p || exit_code=$?
107+
done
108+
exit $exit_code
109+
else
110+
# Run builds in serial
111+
for item in $builds; do
112+
echo "Testing $item"
113+
test $item $parallel_jobs
114+
done
115+
fi
116+
elif [ "$command" == "build_libs" ]; then
117+
build_libs
118+
else
119+
help
120+
fi

scripts/install.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
#
3+
# Install necessary softwares for Ubuntu.
4+
5+
apt-get update
6+
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+
cmake \
17+
software-properties-common
18+
19+
python3 -m pip install --upgrade pip
20+
pip3 install artifacts-keyring
21+
pip3 install gcovr==4.1 $INDEX_URL
22+

scripts/sdl_check.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# !/bin/bash
2+
dir_list="common common_smp common_modules ports ports_module ports_smp samples"
3+
exclude_list="-path TX"
4+
file_list=$(find $dir_list \( $exclude_list \) -prune -o -type f -name '*.[ch]' -print)
5+
cd $(dirname `realpath $0`)/..
6+
echo "Checking for unexpected usage of memcpy..."
7+
echo ""
8+
echo "Excluding:"
9+
echo $exclude_list | grep -P "[^\s]*/[^\s]*" -o
10+
echo ""
11+
echo "Result:"
12+
grep -i "memcpy(" -i $file_list -n | grep -i "use case of .* is verified" -v
13+
if [ "$?" -eq "1" ];
14+
then
15+
echo "CLEAN"
16+
exit 0
17+
else
18+
exit 1
19+
fi

scripts/test_smp.sh

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

scripts/test_tx.sh

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

0 commit comments

Comments
 (0)