xref: /aosp_15_r20/external/ltp/metadata/parse.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#!/bin/sh
2*49cdfc7eSAndroid Build Coastguard Worker# SPDX-License-Identifier: GPL-2.0-or-later
3*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) 2019 Cyril Hrubis <[email protected]>
4*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) 2020 Petr Vorel <[email protected]>
5*49cdfc7eSAndroid Build Coastguard Workerset -e
6*49cdfc7eSAndroid Build Coastguard Worker
7*49cdfc7eSAndroid Build Coastguard Workertop_builddir=$PWD/..
8*49cdfc7eSAndroid Build Coastguard Workertop_srcdir="$(cd $(dirname $0)/..; pwd)"
9*49cdfc7eSAndroid Build Coastguard Worker
10*49cdfc7eSAndroid Build Coastguard Workercd $top_srcdir
11*49cdfc7eSAndroid Build Coastguard Worker
12*49cdfc7eSAndroid Build Coastguard Workerversion=$(cat $top_srcdir/VERSION)
13*49cdfc7eSAndroid Build Coastguard Workerif [ -d .git ]; then
14*49cdfc7eSAndroid Build Coastguard Worker	version=$(git describe 2>/dev/null) || version=$(cat $top_srcdir/VERSION).GIT-UNKNOWN
15*49cdfc7eSAndroid Build Coastguard Workerfi
16*49cdfc7eSAndroid Build Coastguard Worker
17*49cdfc7eSAndroid Build Coastguard Workerecho '{'
18*49cdfc7eSAndroid Build Coastguard Workerecho ' "testsuite": {'
19*49cdfc7eSAndroid Build Coastguard Workerecho '  "name": "Linux Test Project",'
20*49cdfc7eSAndroid Build Coastguard Workerecho '  "short_name": "LTP",'
21*49cdfc7eSAndroid Build Coastguard Workerecho '  "url": "https://github.com/linux-test-project/ltp/",'
22*49cdfc7eSAndroid Build Coastguard Workerecho '  "scm_url_base": "https://github.com/linux-test-project/ltp/tree/master/",'
23*49cdfc7eSAndroid Build Coastguard Workerecho "  \"version\": \"$version\""
24*49cdfc7eSAndroid Build Coastguard Workerecho ' },'
25*49cdfc7eSAndroid Build Coastguard Workerecho ' "defaults": {'
26*49cdfc7eSAndroid Build Coastguard Workerecho '  "timeout": 30'
27*49cdfc7eSAndroid Build Coastguard Workerecho ' },'
28*49cdfc7eSAndroid Build Coastguard Workerecho ' "tests": {'
29*49cdfc7eSAndroid Build Coastguard Worker
30*49cdfc7eSAndroid Build Coastguard Workerfirst=1
31*49cdfc7eSAndroid Build Coastguard Worker
32*49cdfc7eSAndroid Build Coastguard Workerfor test in `find testcases/ -name '*.c'|sort`; do
33*49cdfc7eSAndroid Build Coastguard Worker	a=$($top_builddir/metadata/metaparse -Iinclude -Itestcases/kernel/syscalls/utils/ "$test")
34*49cdfc7eSAndroid Build Coastguard Worker	if [ -n "$a" ]; then
35*49cdfc7eSAndroid Build Coastguard Worker		if [ -z "$first" ]; then
36*49cdfc7eSAndroid Build Coastguard Worker			echo ','
37*49cdfc7eSAndroid Build Coastguard Worker		fi
38*49cdfc7eSAndroid Build Coastguard Worker		first=
39*49cdfc7eSAndroid Build Coastguard Worker		cat <<EOF
40*49cdfc7eSAndroid Build Coastguard Worker$a
41*49cdfc7eSAndroid Build Coastguard WorkerEOF
42*49cdfc7eSAndroid Build Coastguard Worker	fi
43*49cdfc7eSAndroid Build Coastguard Workerdone
44*49cdfc7eSAndroid Build Coastguard Worker
45*49cdfc7eSAndroid Build Coastguard Workerecho
46*49cdfc7eSAndroid Build Coastguard Workerecho ' }'
47*49cdfc7eSAndroid Build Coastguard Workerecho '}'
48