[LTP] [RFC PATCH 0/3] C API: print LTP version

Petr Vorel pvorel@suse.cz
Tue Jul 4 11:39:00 CEST 2023


Hi,

I also wonder, how to print LTP version for C API without requiring
LTPROOT environment variable.

In shell, it could be changed

if [ -z "$LTPROOT" ]; then
-	export LTPROOT="$PWD"
+	export LTPROOT="$(cd "$(dirname "$0")/../.." && pwd)
-	export TST_DATAROOT="$LTPROOT/datafiles"
else
	export TST_DATAROOT="$LTPROOT/testcases/data/$TST_ID"
fi

But that could broke some tests which are using datafiles/ directory inside git
tree.

I was also thinking about replacing LTPROOT in C API with #define generated by
configure script based on prefix. But again, how to have it in shell?
I don't want to have stub (tst_test.sh.in), thus maybe the way would be to
expect "Version" file is in ../../, e.g.

. ../../Version
But with the LTPROOT change above, it could be
. $LTPROOT/Version

Kind regards,
Petr


More information about the ltp mailing list