Hi Khouloud,

The LAVA testdef don't need to be aware of every ptest specific context , If you need to set SYSTEMD_TEST_DATA I suggest to do it
in the systemd ptest.

Regards,
Anibal

On Wed, 17 Apr 2019 at 03:53, Khouloud Touil <ktouil@baylibre.com> wrote:
In case that 'systemd' is one of the ptest to run and to avoid some
test cases failure in the systemd ptest, we need to export the proper
directory that contains the needed systemd test data.
This patch exports the needed test data directory.

Signed-off-by: Khouloud Touil <ktouil@baylibre.com>
---
 automated/linux/ptest/ptest.yaml               |  1 +
 automated/linux/ptest/set-systemd-test-data.sh | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100755 automated/linux/ptest/set-systemd-test-data.sh

diff --git a/automated/linux/ptest/ptest.yaml b/automated/linux/ptest/ptest.yaml
index 6205c11..85f6893 100644
--- a/automated/linux/ptest/ptest.yaml
+++ b/automated/linux/ptest/ptest.yaml
@@ -21,5 +21,6 @@ params:
 run:
     steps:
         - cd ./automated/linux/ptest
+        - ./set-systemd-test-data.sh $TESTS
         - PYTHONIOENCODING=UTF-8 ./ptest.py -o ./result.txt -t ${TESTS} -e ${EXCLUDE}
         - ../../utils/send-to-lava.sh ./result.txt
diff --git a/automated/linux/ptest/set-systemd-test-data.sh b/automated/linux/ptest/set-systemd-test-data.sh
new file mode 100755
index 0000000..0a26b4b
--- /dev/null
+++ b/automated/linux/ptest/set-systemd-test-data.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+#------------------------
+# Some systemd tests needs systemd test data
+# to pass.
+# This script test when there is systemd tests
+# and set the systemd test data
+#------------------------
+tests="$*"
+test_dirs=['/usr/lib/systemd/ptest/tests/test', '/usr/lib64/systemd/ptest/tests/test', '/usr/lib32/systemd/ptest/tests/test']
+for t in $tests; do
+       if [ "$t" == "systemd" ]; then
+               for dir in test_dirs ; do
+                       if [ -e "$dir" ]; then
+                               export SYSTEMD_TEST_DATA=$dir
+                       fi
+               done
+       fi
+done
\ No newline at end of file
--
2.17.1