Create a Karaf post-install script for tests 29/98229/2
authorguillaume.lambert <guillaume.lambert@orange.com>
Mon, 28 Jun 2021 08:54:10 +0000 (10:54 +0200)
committerVachhani, Shweta (sv111y) <sv111y@att.com>
Sun, 31 Oct 2021 11:24:29 +0000 (07:24 -0400)
- add a post-install shell script for Karaf and tests purpose
  This post-install script will be copied at build-time from
  src/main/assembly/ressources to target/assembly/ressources
- move the tox.ini sed command used to patch Karaf exec into this script
- update this command since there is no more quoting hell issues
- update tox.ini accordingly

JIRA: TRNSPRTPCE-482
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: Iac1bfa3b4bf7a8d0e55130abf2f4cbf349f14ba4

karaf/src/main/assembly/ressources/post_install_for_tests.sh [new file with mode: 0755]
tox.ini

diff --git a/karaf/src/main/assembly/ressources/post_install_for_tests.sh b/karaf/src/main/assembly/ressources/post_install_for_tests.sh
new file mode 100755 (executable)
index 0000000..3e24b88
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+cd $(dirname $0)
+sed -i'_' -e '1 a\
+\
+. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh' ../bin/karaf
diff --git a/tox.ini b/tox.ini
index 879d1fc60914c2e08780e847ff97d43168ec4c20..b763ce428a3c2b94e5b653ccc0b1bea08bc8800d 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -35,12 +35,7 @@ commands =
   sh -c ". $PWD/reflectwarn.sh && cd .. && mvn clean install -B -q -s tests/odl_settings.xml -DskipTests -Dmaven.javadoc.skip=true -Dodlparent.spotbugs.skip -Dodlparent.checkstyle.skip"
   sh -c "mv  ../olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java_  ../olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java"
 #patch Karaf exec for the same reason at runtime
-  sh -c "sed -i'_' 's@!/bin/sh@!/bin/sh\'$'\n. $(dirname $0)/../../../../tests/reflectwarn.sh@' ../karaf/target/assembly/bin/karaf"
-  # the following command would be the straight and right way to support both BSD and GNU sed versions
-  # sh -c "sed -i'_' '1 a\'$'\n. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh\n' ../karaf/target/assembly/bin/karaf"
-  # but tox reinterprets the quotes as
-  # sh -c 'sed -i'"'"'_'"'"' '"'"'1 a\'"'"'$'"'"'\n. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh\n'"'"' ../karaf/target/assembly/bin/karaf'
-  # ,what results in an unexpected different formating (with a $ on the second line and the dot on the third)
+  sh -c "../karaf/target/assembly/ressources/post_install_for_tests.sh"
 #build Lighty if needed
   sh -c 'if [ "$USE_LIGHTY" = "True" ]; then (cd ../lighty && ./build.sh); fi'