Skip to contentSkip to conversation

metadata: improvements

PATCH In review Petr Vorel 1 participant 6 messages Jan 4, 2024

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover metadata: improvements

From: Petr Vorel <[email protected]>

Hi all,

there are 3 parts:

1) The main motivation is to avoid having to fix docs manually, implemented in commit "metaparse: Add missing blank line on the list".

2) Add CI job for generating metadata, to catch the problem early (we test metadata in docker/podman CI jobs, but error there is quite hidden. Having special job (which is quick) will show the problem immediately.

3) Minor verbose output improvements.

Kind regards,
Petr

Petr Vorel (9):
metaparse: Print parsing file on verbose
metadata: parse.sh: Allow to pass list of files
metadata: parse.sh: Pass -v to metaparse on VERBOSE=1
metadata: test.sh: Print more info on VERBOSE=1
metaparse: Verbose output on V=1
metaparse: Add missing blank line on the list
metadata: Add test for missing blank line in list ci/debian: Allow to install packages only for docparse
ci: Add job for building metadata

 .github/workflows/metadata.yml                | 58 +++++++++++++++++++
 ci/debian.sh                                  | 17 +++++-
 metadata/Makefile                             |  4 +-
 metadata/data_storage.h                       | 36 +++++++++++-
 metadata/metaparse.c                          |  3 +
 metadata/parse.sh                             | 13 ++++-
 metadata/tests/list_missing_blank_line.c      | 14 +++++
 metadata/tests/list_missing_blank_line.c.json | 18 ++++++
 metadata/tests/test.sh                        |  2 +
 9 files changed, 159 insertions(+), 6 deletions(-)
 create mode 100644 .github/workflows/metadata.yml
 create mode 100644 metadata/tests/list_missing_blank_line.c
 create mode 100644 metadata/tests/list_missing_blank_line.c.json
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

PATCH 1/9 metaparse: Print parsing file on verbose

From: Petr Vorel <[email protected]>

---
 metadata/metaparse.c | 3 +++
 1 file changed, 3 insertions(+)
metadata/metaparse.c +3 -0
index 2384c73c8..fe6d68911 100644
@@ -862,6 +862,9 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
+	if (verbose)
+		fprintf(stderr, "\n=== %s ===\n", argv[optind]);
+
 	res = parse_file(argv[optind]);
 	if (!res)
 		return 0;
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw

PATCH 2/9 metadata: parse.sh: Allow to pass list of files

In reply to Petr Vorel

From: Petr Vorel <[email protected]>

---
 metadata/parse.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
metadata/parse.sh +8 -1
index 69bf5db65..9dd097153 100755
@@ -2,6 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2019 Cyril Hrubis <[email protected]>
 # Copyright (c) 2020 Petr Vorel <[email protected]>
+# Copyright (c) Linux Test Project, 2022-2024
 set -e
 
 top_builddir=$PWD/..
@@ -29,7 +30,13 @@ echo ' "tests": {'
 
 first=1
 
-for test in `find testcases/ -name '*.c'|sort`; do
+if [ $# -gt 0 ]; then
+	tests=$*
+else
+	tests=$(find testcases/ -name '*.c' | sort)
+fi
+
+for test in $tests; do
 	a=$($top_builddir/metadata/metaparse -Iinclude -Itestcases/kernel/syscalls/utils/ "$test")
 	if [ -n "$a" ]; then
 		if [ -z "$first" ]; then
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#3 lore raw

PATCH 3/9 metadata: parse.sh: Pass -v to metaparse on VERBOSE=1

In reply to Petr Vorel

From: Petr Vorel <[email protected]>

---
 metadata/parse.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
metadata/parse.sh +3 -1
index 9dd097153..83a3683b5 100755
@@ -36,8 +36,10 @@ else
 	tests=$(find testcases/ -name '*.c' | sort)
 fi
 
+[ "$VERBOSE" ] && v="-v"
+
 for test in $tests; do
-	a=$($top_builddir/metadata/metaparse -Iinclude -Itestcases/kernel/syscalls/utils/ "$test")
+	a=$($top_builddir/metadata/metaparse $v -Iinclude -Itestcases/kernel/syscalls/utils/ "$test")
 	if [ -n "$a" ]; then
 		if [ -z "$first" ]; then
 			echo ','
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw

PATCH 4/9 metadata: test.sh: Print more info on VERBOSE=1

In reply to Petr Vorel

From: Petr Vorel <[email protected]>

---
 metadata/tests/test.sh | 2 ++
 1 file changed, 2 insertions(+)
metadata/tests/test.sh +2 -0
index 475d721df..a00e32bb4 100755
@@ -3,6 +3,7 @@
 fail=0
 
 for i in *.c; do
+	[ "$VERBOSE" ] && echo "$0: testing $i"
 	../metaparse $i > tmp.json
 	if ! diff tmp.json $i.json >/dev/null 2>&1; then
 		echo "***"
@@ -15,4 +16,5 @@ done
 
 rm -f tmp.json
 
+[ "$VERBOSE" ] && echo "$fail"
 exit $fail
Signature · 5 lines
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#5 lore raw
In reply to Petr Vorel

Hi,

I'm very sorry for the noise (I sent part of this patchset 2x).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp