[meta-oe][PATCH 4/9] pegtl: install ptest data files where the tests look for them

Khem Raj <[email protected]>
Newsgroups org.openembedded.lists.openembedded-devel
Message-ID <[email protected]>
From: Khem Raj <[email protected]>

14 of the 257 pegtl tests failed - every test that reads a data file
(input_file_input, input_mmap_input, internal_file_mapper,
internal_read_file_stdio, stream_*_input, example_json, ...) while the
243 tests that parse in-memory strings passed.

Upstream runs its tests from the source root:

  src/test/CMakeLists.txt:299
  add_test(NAME ${exename} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ...)

so the tests open their data with CWD-relative literals - grepping the
test sources shows src/test/data/duseltronik.txt (7 references),
src/test/data/test_data.txt (4) and src/test/data/{blns,pass1-3,
fail1-39}.json. run-ptest executes the binaries from ${PTEST_PATH}, so
the data has to be at ${PTEST_PATH}/src/test/data/.

The recipe instead installed it to src/test/pegtl/data - one directory
too deep - and copied only *.json, so test_data.txt and
duseltronik.txt were missing entirely. Install all of src/test/data
to the path the tests actually use. The binaries stay in
src/test/pegtl, which is where run-ptest globs for them.

Signed-off-by: Khem Raj <[email protected]>
---
 meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb b/meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb
index 2676231dca..afaf8f997b 100644
--- a/meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb
+++ b/meta-oe/recipes-extended/pegtl/pegtl_4.0.1.bb
@@ -12,8 +12,9 @@ SRCREV = "9ec6da187f840d8e804d42b9b7867f79d5d6adc2"
 inherit cmake ptest

 do_install_ptest () {
-    install -d ${D}${PTEST_PATH}/src/test/pegtl/data
+    install -d ${D}${PTEST_PATH}/src/test/pegtl
+    install -d ${D}${PTEST_PATH}/src/test/data
     install -m 0755 ${B}/src/test/pegtl-test-* ${D}${PTEST_PATH}/src/test/pegtl
-    install ${S}/src/test/file_*.txt ${D}${PTEST_PATH}/src/test/pegtl
-    install ${S}/src/test/data/*.json ${D}${PTEST_PATH}/src/test/pegtl/data
+    install -m 0644 ${S}/src/test/file_*.txt ${D}${PTEST_PATH}/src/test/
+    install -m 0644 ${S}/src/test/data/* ${D}${PTEST_PATH}/src/test/data/
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.