1f08c3bdfSopenharmony_ci#!/bin/sh
2f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later
3f08c3bdfSopenharmony_ci# Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
4f08c3bdfSopenharmony_ci# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
5f08c3bdfSopenharmony_ciset -e
6f08c3bdfSopenharmony_ci
7f08c3bdfSopenharmony_citop_builddir=$PWD/..
8f08c3bdfSopenharmony_citop_srcdir="$(cd $(dirname $0)/..; pwd)"
9f08c3bdfSopenharmony_ci
10f08c3bdfSopenharmony_cicd $top_srcdir
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_civersion=$(cat $top_srcdir/VERSION)
13f08c3bdfSopenharmony_ciif [ -d .git ]; then
14f08c3bdfSopenharmony_ci	version=$(git describe 2>/dev/null) || version=$(cat $top_srcdir/VERSION).GIT-UNKNOWN
15f08c3bdfSopenharmony_cifi
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ciecho '{'
18f08c3bdfSopenharmony_ciecho ' "testsuite": {'
19f08c3bdfSopenharmony_ciecho '  "name": "Linux Test Project",'
20f08c3bdfSopenharmony_ciecho '  "short_name": "LTP",'
21f08c3bdfSopenharmony_ciecho '  "url": "https://github.com/linux-test-project/ltp/",'
22f08c3bdfSopenharmony_ciecho '  "scm_url_base": "https://github.com/linux-test-project/ltp/tree/master/",'
23f08c3bdfSopenharmony_ciecho "  \"version\": \"$version\""
24f08c3bdfSopenharmony_ciecho ' },'
25f08c3bdfSopenharmony_ciecho ' "defaults": {'
26f08c3bdfSopenharmony_ciecho '  "timeout": 30'
27f08c3bdfSopenharmony_ciecho ' },'
28f08c3bdfSopenharmony_ciecho ' "tests": {'
29f08c3bdfSopenharmony_ci
30f08c3bdfSopenharmony_cifirst=1
31f08c3bdfSopenharmony_ci
32f08c3bdfSopenharmony_cifor test in `find testcases/ -name '*.c'|sort`; do
33f08c3bdfSopenharmony_ci	a=$($top_builddir/metadata/metaparse -Iinclude -Itestcases/kernel/syscalls/utils/ "$test")
34f08c3bdfSopenharmony_ci	if [ -n "$a" ]; then
35f08c3bdfSopenharmony_ci		if [ -z "$first" ]; then
36f08c3bdfSopenharmony_ci			echo ','
37f08c3bdfSopenharmony_ci		fi
38f08c3bdfSopenharmony_ci		first=
39f08c3bdfSopenharmony_ci		cat <<EOF
40f08c3bdfSopenharmony_ci$a
41f08c3bdfSopenharmony_ciEOF
42f08c3bdfSopenharmony_ci	fi
43f08c3bdfSopenharmony_cidone
44f08c3bdfSopenharmony_ci
45f08c3bdfSopenharmony_ciecho
46f08c3bdfSopenharmony_ciecho ' }'
47f08c3bdfSopenharmony_ciecho '}'
48