* [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version
@ 2023-07-19 11:00 Petr Vorel
2023-07-19 11:00 ` [LTP] [PATCH v2 1/4] " Petr Vorel
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Petr Vorel @ 2023-07-19 11:00 UTC (permalink / raw)
To: ltp
Hi,
changes v1->v2:
* proper make solution from Cyril, slightly modified (first commit)
ltp-version.h gets regenerated only when make requires to run in lib/,
but I'm ok with that.
* .gitignore cleanup (last commit)
I wonder how about shell API? Do we want to create tst_version binary in
testcases/lib/ ?
Kind regards,
Petr
Cyril Hrubis (1):
Makefile: Add C header with generated LTP version
Petr Vorel (3):
lib/C-API: Add option -V to print LTP version
lib/C-API: Print LTP version at test start
lib: Move gitignore entries to their directory
.gitignore | 18 ------------------
lib/.gitignore | 3 +++
lib/Makefile | 13 +++++++++++++
lib/gen_version.sh | 16 ++++++++++++++++
lib/tests/.gitignore | 17 +++++++++++++++++
lib/tst_test.c | 8 ++++++++
6 files changed, 57 insertions(+), 18 deletions(-)
create mode 100644 lib/.gitignore
create mode 100755 lib/gen_version.sh
create mode 100644 lib/tests/.gitignore
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2 1/4] Makefile: Add C header with generated LTP version
2023-07-19 11:00 [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Petr Vorel
@ 2023-07-19 11:00 ` Petr Vorel
2023-07-20 5:23 ` Li Wang
2023-07-19 11:00 ` [LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print " Petr Vorel
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2023-07-19 11:00 UTC (permalink / raw)
To: ltp
From: Cyril Hrubis <chrubis@suse.cz>
It will be used for printing LTP version in C API.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
lib/.gitignore | 2 ++
lib/Makefile | 13 +++++++++++++
lib/gen_version.sh | 16 ++++++++++++++++
3 files changed, 31 insertions(+)
create mode 100644 lib/.gitignore
create mode 100755 lib/gen_version.sh
diff --git a/lib/.gitignore b/lib/.gitignore
new file mode 100644
index 000000000..1bd967e2f
--- /dev/null
+++ b/lib/.gitignore
@@ -0,0 +1,2 @@
+/ltp-version.h
+/cached-version
diff --git a/lib/Makefile b/lib/Makefile
index 9b9906f25..ac1f62048 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -20,6 +20,19 @@ pc_file := $(DESTDIR)/$(datarootdir)/pkgconfig/ltp.pc
INSTALL_TARGETS := $(pc_file)
+tst_test.o: ltp-version.h
+
+ltp-version.h: gen_version
+
+MAKE_TARGETS += gen_version
+
+.PHONY: gen_version
+gen_version:
+ @echo GEN ltp-version.h
+ @./gen_version.sh
+
+CLEAN_TARGETS += ltp-version.h cached-version
+
$(pc_file):
test -d "$(@D)" || mkdir -p "$(@D)"
install -m $(INSTALL_MODE) "$(builddir)/$(@F)" "$@"
diff --git a/lib/gen_version.sh b/lib/gen_version.sh
new file mode 100755
index 000000000..5d4250755
--- /dev/null
+++ b/lib/gen_version.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+touch cached-version
+
+if git describe >/dev/null 2>&1; then
+ VERSION=`git describe`
+else
+ VERSION=`cat $(dirname $0)/../VERSION`
+fi
+
+CACHED_VERSION=`cat cached-version`
+
+if [ "$CACHED_VERSION" != "$VERSION" ]; then
+ echo "$VERSION" > cached-version
+ echo "#define LTP_VERSION \"$VERSION\"" > ltp-version.h
+fi
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print LTP version
2023-07-19 11:00 [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Petr Vorel
2023-07-19 11:00 ` [LTP] [PATCH v2 1/4] " Petr Vorel
@ 2023-07-19 11:00 ` Petr Vorel
2023-07-25 12:01 ` Cyril Hrubis
2023-07-19 11:00 ` [LTP] [PATCH v2 3/4] lib/C-API: Print LTP version at test start Petr Vorel
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2023-07-19 11:00 UTC (permalink / raw)
To: ltp
It can be useful for troubleshooting reported issues.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
lib/tst_test.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 04da456c6..456d3d1e6 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -34,6 +34,7 @@
#include "old_resource.h"
#include "old_device.h"
#include "old_tmpdir.h"
+#include "ltp-version.h"
/*
* Hack to get TCID defined in newlib tests
@@ -509,6 +510,7 @@ static struct option {
{"h", "-h Prints this help"},
{"i:", "-i n Execute test n times"},
{"I:", "-I x Execute test for n seconds"},
+ {"V", "-V Prints LTP version"},
{"C:", "-C ARG Run child process with ARG arguments (used internally)"},
};
@@ -686,6 +688,10 @@ static void parse_opts(int argc, char *argv[])
else
duration = SAFE_STRTOF(optarg, 0.1, HUGE_VALF);
break;
+ case 'V':
+ fprintf(stderr, "LTP version: " LTP_VERSION "\n");
+ exit(0);
+ break;
case 'C':
#ifdef UCLINUX
child_args = optarg;
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2 3/4] lib/C-API: Print LTP version at test start
2023-07-19 11:00 [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Petr Vorel
2023-07-19 11:00 ` [LTP] [PATCH v2 1/4] " Petr Vorel
2023-07-19 11:00 ` [LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print " Petr Vorel
@ 2023-07-19 11:00 ` Petr Vorel
2023-07-25 12:06 ` Cyril Hrubis
2023-07-19 11:00 ` [LTP] [PATCH v2 4/4] lib: Move gitignore entries to their directory Petr Vorel
2023-09-06 9:40 ` [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Cyril Hrubis
4 siblings, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2023-07-19 11:00 UTC (permalink / raw)
To: ltp
Although -V option for printing version was added in previous commit,
having a way to always print LTP version at the beginning of the test
(makes debugging of troubleshooting reported issues even easier).
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
lib/tst_test.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 456d3d1e6..0fcb43809 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1677,6 +1677,8 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
SAFE_SIGNAL(SIGALRM, alarm_handler);
SAFE_SIGNAL(SIGUSR1, heartbeat_handler);
+ tst_res(TINFO, "LTP version: "LTP_VERSION);
+
if (tst_test->max_runtime)
results->max_runtime = multiply_runtime(tst_test->max_runtime);
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [LTP] [PATCH v2 4/4] lib: Move gitignore entries to their directory
2023-07-19 11:00 [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Petr Vorel
` (2 preceding siblings ...)
2023-07-19 11:00 ` [LTP] [PATCH v2 3/4] lib/C-API: Print LTP version at test start Petr Vorel
@ 2023-07-19 11:00 ` Petr Vorel
2023-07-25 12:02 ` Cyril Hrubis
2023-09-06 9:40 ` [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Cyril Hrubis
4 siblings, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2023-07-19 11:00 UTC (permalink / raw)
To: ltp
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
.gitignore | 18 ------------------
lib/.gitignore | 1 +
lib/tests/.gitignore | 17 +++++++++++++++++
3 files changed, 18 insertions(+), 18 deletions(-)
create mode 100644 lib/tests/.gitignore
diff --git a/.gitignore b/.gitignore
index 915d22104..85bcf052b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,7 +41,6 @@ autom4te.cache
/include/mk/config-openposix.mk
/include/mk/features.mk
/m4/ltp-version.m4
-/lib/ltp.pc
/pan/ltp-bump
/pan/ltp-pan
@@ -63,20 +62,3 @@ patches/
logfile.*
/utils/benchmark/ebizzy-0.3/ebizzy
-/lib/tests/tst_tmpdir_test
-/lib/tests/tst_checkpoint
-/lib/tests/tst_checkpoint_wait_timeout
-/lib/tests/tst_checkpoint_wake_timeout
-/lib/tests/tst_process_state
-/lib/tests/tst_cleanup_once
-/lib/tests/tst_safe_macros
-/lib/tests/tst_strsig
-/lib/tests/tst_strerrno
-/lib/tests/tst_fs_fill_subdirs
-/lib/tests/tst_fs_fill_hardlinks
-/lib/tests/tst_device
-/lib/tests/tst_record_childstatus
-/lib/tests/trerrno
-/lib/tests/tst_dataroot01
-/lib/tests/tst_dataroot02
-/lib/tests/tst_dataroot03
diff --git a/lib/.gitignore b/lib/.gitignore
index 1bd967e2f..eb9901169 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1,2 +1,3 @@
/ltp-version.h
/cached-version
+/ltp.pc
diff --git a/lib/tests/.gitignore b/lib/tests/.gitignore
new file mode 100644
index 000000000..1d880c1b7
--- /dev/null
+++ b/lib/tests/.gitignore
@@ -0,0 +1,17 @@
+/tst_tmpdir_test
+/tst_checkpoint
+/tst_checkpoint_wait_timeout
+/tst_checkpoint_wake_timeout
+/tst_process_state
+/tst_cleanup_once
+/tst_safe_macros
+/tst_strsig
+/tst_strerrno
+/tst_fs_fill_subdirs
+/tst_fs_fill_hardlinks
+/tst_device
+/tst_record_childstatus
+/trerrno
+/tst_dataroot01
+/tst_dataroot02
+/tst_dataroot03
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/4] Makefile: Add C header with generated LTP version
2023-07-19 11:00 ` [LTP] [PATCH v2 1/4] " Petr Vorel
@ 2023-07-20 5:23 ` Li Wang
2023-07-20 7:28 ` Petr Vorel
0 siblings, 1 reply; 12+ messages in thread
From: Li Wang @ 2023-07-20 5:23 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi Petr,
On Wed, Jul 19, 2023 at 7:01 PM Petr Vorel <pvorel@suse.cz> wrote:
> From: Cyril Hrubis <chrubis@suse.cz>
>
> It will be used for printing LTP version in C API.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> lib/.gitignore | 2 ++
> lib/Makefile | 13 +++++++++++++
> lib/gen_version.sh | 16 ++++++++++++++++
> 3 files changed, 31 insertions(+)
> create mode 100644 lib/.gitignore
> create mode 100755 lib/gen_version.sh
>
> diff --git a/lib/.gitignore b/lib/.gitignore
> new file mode 100644
> index 000000000..1bd967e2f
> --- /dev/null
> +++ b/lib/.gitignore
> @@ -0,0 +1,2 @@
> +/ltp-version.h
> +/cached-version
> diff --git a/lib/Makefile b/lib/Makefile
> index 9b9906f25..ac1f62048 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -20,6 +20,19 @@ pc_file :=
> $(DESTDIR)/$(datarootdir)/pkgconfig/ltp.pc
>
> INSTALL_TARGETS := $(pc_file)
>
> +tst_test.o: ltp-version.h
> +
> +ltp-version.h: gen_version
> +
> +MAKE_TARGETS += gen_version
> +
> +.PHONY: gen_version
> +gen_version:
> + @echo GEN ltp-version.h
> + @./gen_version.sh
>
If we build LTP out of the source tree, it failed with no
such file gen_version.sh.
By adding the absolute path then works.
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,7 +29,7 @@ MAKE_TARGETS += gen_version
.PHONY: gen_version
gen_version:
@echo GEN ltp-version.h
- @./gen_version.sh
+ @$(top_srcdir)/lib/gen_version.sh
CLEAN_TARGETS += ltp-version.h cached-version
For patch series:
Reviewed-by: Li Wang <liwang@redhat.com>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 1/4] Makefile: Add C header with generated LTP version
2023-07-20 5:23 ` Li Wang
@ 2023-07-20 7:28 ` Petr Vorel
0 siblings, 0 replies; 12+ messages in thread
From: Petr Vorel @ 2023-07-20 7:28 UTC (permalink / raw)
To: Li Wang; +Cc: ltp
Hi Li,
> If we build LTP out of the source tree, it failed with no
> such file gen_version.sh.
> By adding the absolute path then works.
Good catch, thank you!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print LTP version
2023-07-19 11:00 ` [LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print " Petr Vorel
@ 2023-07-25 12:01 ` Cyril Hrubis
2023-07-25 12:23 ` Petr Vorel
0 siblings, 1 reply; 12+ messages in thread
From: Cyril Hrubis @ 2023-07-25 12:01 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi!
> It can be useful for troubleshooting reported issues.
I still wonder if this should be rather put into the output of the -h or
both.
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> lib/tst_test.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 04da456c6..456d3d1e6 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -34,6 +34,7 @@
> #include "old_resource.h"
> #include "old_device.h"
> #include "old_tmpdir.h"
> +#include "ltp-version.h"
>
> /*
> * Hack to get TCID defined in newlib tests
> @@ -509,6 +510,7 @@ static struct option {
> {"h", "-h Prints this help"},
> {"i:", "-i n Execute test n times"},
> {"I:", "-I x Execute test for n seconds"},
> + {"V", "-V Prints LTP version"},
> {"C:", "-C ARG Run child process with ARG arguments (used internally)"},
> };
>
> @@ -686,6 +688,10 @@ static void parse_opts(int argc, char *argv[])
> else
> duration = SAFE_STRTOF(optarg, 0.1, HUGE_VALF);
> break;
> + case 'V':
> + fprintf(stderr, "LTP version: " LTP_VERSION "\n");
> + exit(0);
> + break;
> case 'C':
> #ifdef UCLINUX
> child_args = optarg;
> --
> 2.40.1
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 4/4] lib: Move gitignore entries to their directory
2023-07-19 11:00 ` [LTP] [PATCH v2 4/4] lib: Move gitignore entries to their directory Petr Vorel
@ 2023-07-25 12:02 ` Cyril Hrubis
0 siblings, 0 replies; 12+ messages in thread
From: Cyril Hrubis @ 2023-07-25 12:02 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 3/4] lib/C-API: Print LTP version at test start
2023-07-19 11:00 ` [LTP] [PATCH v2 3/4] lib/C-API: Print LTP version at test start Petr Vorel
@ 2023-07-25 12:06 ` Cyril Hrubis
0 siblings, 0 replies; 12+ messages in thread
From: Cyril Hrubis @ 2023-07-25 12:06 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print LTP version
2023-07-25 12:01 ` Cyril Hrubis
@ 2023-07-25 12:23 ` Petr Vorel
0 siblings, 0 replies; 12+ messages in thread
From: Petr Vorel @ 2023-07-25 12:23 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: Martin Doucha, ltp, Richard Palethorpe
Hi Cyril,
> Hi!
> > It can be useful for troubleshooting reported issues.
> I still wonder if this should be rather put into the output of the -h or
> both.
I used -V, because this is common, but I have no problem to add it to -h
or even move to -h (i.e. not introduce -V).
Any more opinions, please?
Kind regards,
Petr
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> > lib/tst_test.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> > diff --git a/lib/tst_test.c b/lib/tst_test.c
> > index 04da456c6..456d3d1e6 100644
> > --- a/lib/tst_test.c
> > +++ b/lib/tst_test.c
> > @@ -34,6 +34,7 @@
> > #include "old_resource.h"
> > #include "old_device.h"
> > #include "old_tmpdir.h"
> > +#include "ltp-version.h"
> > /*
> > * Hack to get TCID defined in newlib tests
> > @@ -509,6 +510,7 @@ static struct option {
> > {"h", "-h Prints this help"},
> > {"i:", "-i n Execute test n times"},
> > {"I:", "-I x Execute test for n seconds"},
> > + {"V", "-V Prints LTP version"},
> > {"C:", "-C ARG Run child process with ARG arguments (used internally)"},
> > };
> > @@ -686,6 +688,10 @@ static void parse_opts(int argc, char *argv[])
> > else
> > duration = SAFE_STRTOF(optarg, 0.1, HUGE_VALF);
> > break;
> > + case 'V':
> > + fprintf(stderr, "LTP version: " LTP_VERSION "\n");
> > + exit(0);
> > + break;
> > case 'C':
> > #ifdef UCLINUX
> > child_args = optarg;
> > --
> > 2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version
2023-07-19 11:00 [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Petr Vorel
` (3 preceding siblings ...)
2023-07-19 11:00 ` [LTP] [PATCH v2 4/4] lib: Move gitignore entries to their directory Petr Vorel
@ 2023-09-06 9:40 ` Cyril Hrubis
4 siblings, 0 replies; 12+ messages in thread
From: Cyril Hrubis @ 2023-09-06 9:40 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi!
Patchset pushed with the fix from Li applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-09-06 9:39 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-19 11:00 [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Petr Vorel
2023-07-19 11:00 ` [LTP] [PATCH v2 1/4] " Petr Vorel
2023-07-20 5:23 ` Li Wang
2023-07-20 7:28 ` Petr Vorel
2023-07-19 11:00 ` [LTP] [PATCH v2 2/4] lib/C-API: Add option -V to print " Petr Vorel
2023-07-25 12:01 ` Cyril Hrubis
2023-07-25 12:23 ` Petr Vorel
2023-07-19 11:00 ` [LTP] [PATCH v2 3/4] lib/C-API: Print LTP version at test start Petr Vorel
2023-07-25 12:06 ` Cyril Hrubis
2023-07-19 11:00 ` [LTP] [PATCH v2 4/4] lib: Move gitignore entries to their directory Petr Vorel
2023-07-25 12:02 ` Cyril Hrubis
2023-09-06 9:40 ` [LTP] [PATCH v2 0/4] Makefile: Add C header with generated LTP version Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox