Skip to content

Commit bc080d0

Browse files
committed
Create generic matrix script
The script expects a test array an builds a json {"test":["test1", "test2"]}, and it is used by kselftest and ltp to create the text matrix Signed-off-by: Camila Alvarez <cam.alvarez.i@gmail.com>
1 parent 2c1b907 commit bc080d0

File tree

6 files changed

+37
-9
lines changed

6 files changed

+37
-9
lines changed

.github/scripts/ltp.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ OUT_DIR="/tests/results_json"
2121
# dependencies
2222
source /build/.env/bin/activate
2323

24-
# TODO ltp-controllers is too slow for now because of cgroup_fj_stress.sh
25-
# but I haven't found an easy to skip this one from tuxrun
26-
ltp_tests=( "ltp-commands" "ltp-syscalls" "ltp-mm" "ltp-hugetlb" "ltp-crypto" "ltp-cve" "ltp-containers" "ltp-fs" "ltp-sched" )
2724

2825
mkdir -p $OUT_DIR
2926

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
TESTS=($@)
6+
7+
PARSED_TESTS=$( printf '%s\n' "${TESTS[@]}" | jq -R . | jq -cs .)
8+
JSON=$(jq -cn --argjson tests "$PARSED_TESTS" '{test: $tests}')
9+
echo "$JSON"
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/bash
22

33
set -euo pipefail
4-
54
d=`dirname ${BASH_SOURCE[0]}`
6-
. $d/series/utils.sh
5+
. $d/../series/utils.sh
76
selftests=$1
87
output=$2
98
name=${3:-"matrix"}
@@ -13,6 +12,5 @@ curl -L $selftests -o selftests.tar.gz &&\
1312
tar xvf selftests.tar.gz
1413

1514
parse_tests_array .
16-
KTESTS=$( printf '%s\n' "${kselftest_subtests[@]}" | jq -R . | jq -cs .)
17-
JSON=$(jq -cn --argjson tests "$KTESTS" '{test: $tests}')
18-
echo "$name$separator$JSON" >> $output
15+
json=$($d/generate_json.sh "${kselftest_subtests[@]}")
16+
echo $name$separator$json >> $output
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
d=`dirname ${BASH_SOURCE[0]}`
6+
7+
output=$1
8+
name=${2:-"matrix"}
9+
separator=${3:-"="}
10+
# TODO ltp-controllers is too slow for now because of cgroup_fj_stress.sh
11+
# but I haven't found an easy to skip this one from tuxrun
12+
ltp_tests=( "ltp-commands" "ltp-syscalls" "ltp-mm" "ltp-hugetlb" "ltp-crypto" "ltp-cve" "ltp-containers" "ltp-fs" "ltp-sched" )
13+
json=$($d/generate_json.sh "${ltp_tests[@]}")
14+
echo $name$separator$json >> $output

.github/workflows/kselftest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: Create Matrix
4141
id: create-matrix
4242
run: |
43-
./.github/scripts/generate_tests_array.sh "${{ inputs.selftests-url }}" $GITHUB_OUTPUT
43+
./.github/scripts/matrix/kselftest_matrix.sh "${{ inputs.selftests-url }}" $GITHUB_OUTPUT
4444
4545
run-tests:
4646
runs-on: ubuntu-latest

.github/workflows/ltp.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ on:
2121
type: string
2222

2323
jobs:
24+
setup-matrix:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
matrix: ${{ steps.matrix.outputs.matrix }}
28+
steps:
29+
- name: Create LTP matrix
30+
id: matrix
31+
run: |
32+
./.github/scripts/matrix/ltp_matrix.sh $GITHUB_OUTPUT
33+
2434
run-ltp:
2535
runs-on: ubuntu-latest
2636
needs: setup-matrix

0 commit comments

Comments
 (0)