[gjs: 2/4] CI: run an extra check on installed shell script tests
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 2/4] CI: run an extra check on installed shell script tests
- Date: Fri, 20 Jul 2018 01:13:49 +0000 (UTC)
commit f69a2f43a3bf7b07b527657ad166866a5146b75a
Author: Claudio André <claudioandre br gmail com>
Date: Wed Jul 11 17:03:37 2018 -0300
CI: run an extra check on installed shell script tests
.gitlab-ci.yml | 8 +++++
installed-tests/scripts/common.sh | 47 +++++++++++++++++++++++++++
installed-tests/scripts/testExamples.sh | 56 ++++++++++++---------------------
test/test-ci.sh | 35 +++++++++++++++++----
4 files changed, 104 insertions(+), 42 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ca30df3b..d681f8b8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -85,6 +85,12 @@ stages:
fi
'
+ # Run the script tests again (to assure they are working)
+ - 'if [[ -n "${SCRIPTCHECK}" ]]; then
+ $(pwd)/test/test-ci.sh SH_CHECKS;
+ fi
+ '
+
# Done
- *CI_footer
@@ -154,6 +160,7 @@ with_logging:
CC: clang
BUILD_OPTS: CPPFLAGS='-DGJS_VERBOSE_ENABLE_PROPS=1 -DGJS_VERBOSE_ENABLE_MARSHAL=1
-DGJS_VERBOSE_ENABLE_LIFECYCLE=1 -DGJS_VERBOSE_ENABLE_GI_USAGE=1 -DGJS_VERBOSE_ENABLE_CLOSURE=1
-DGJS_VERBOSE_ENABLE_GSIGNAL=1'
TEST: "check"
+ SCRIPTCHECK: "yes"
except:
- schedules
@@ -165,6 +172,7 @@ no_graphics:
TASK_ID: "fedora-x86_64-gcc-default-without_gtk-check"
TEST: "check"
BUILD_OPTS: "--without-cairo --without-gtk"
+ SCRIPTCHECK: "yes"
except:
- schedules
diff --git a/installed-tests/scripts/common.sh b/installed-tests/scripts/common.sh
new file mode 100755
index 00000000..7ffdb765
--- /dev/null
+++ b/installed-tests/scripts/common.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then
+ gjs="$LOG_COMPILER $LOG_FLAGS $TOP_BUILDDIR/gjs-console"
+else
+ gjs="$LOG_COMPILER $LOG_FLAGS gjs-console"
+fi
+
+# Avoid interference in the profiler tests from stray environment variable
+unset GJS_ENABLE_PROFILER
+
+total=0
+
+report () {
+ exit_code=$?
+ total=$((total + 1))
+ if test $exit_code -eq 0; then
+ echo "ok $total - $1"
+ else
+ echo "not ok $total - $1 [EXIT CODE: $exit_code]"
+ fi
+}
+
+report_timeout () {
+ exit_code=$?
+ total=$((total + 1))
+ if test $exit_code -eq 0 -o $exit_code -eq 124; then
+ echo "ok $total - $1"
+ else
+ echo "not ok $total - $1 [EXIT CODE: $exit_code]"
+ fi
+}
+
+report_xfail () {
+ exit_code=$?
+ total=$((total + 1))
+ if test $exit_code -ne 0; then
+ echo "ok $total - $1"
+ else
+ echo "not ok $total - $1"
+ fi
+}
+
+skip () {
+ total=$((total + 1))
+ echo "ok $total - $1 # SKIP $2"
+}
diff --git a/installed-tests/scripts/testExamples.sh b/installed-tests/scripts/testExamples.sh
index d4a1a233..06496238 100755
--- a/installed-tests/scripts/testExamples.sh
+++ b/installed-tests/scripts/testExamples.sh
@@ -1,43 +1,27 @@
#!/bin/sh
-
-if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then
- gjs="$LOG_COMPILER $LOG_FLAGS $TOP_BUILDDIR/gjs-console"
-else
- gjs="$LOG_COMPILER $LOG_FLAGS gjs-console"
-fi
-
-# Avoid interference in the profiler tests from stray environment variable
-unset GJS_ENABLE_PROFILER
-
-total=0
-
-report () {
- exit_code=$?
- total=$((total + 1))
- if test $exit_code -eq 0; then
- echo "ok $total - $1"
- else
- echo "not ok $total - $1"
- fi
-}
-
-report_xfail () {
- exit_code=$?
- total=$((total + 1))
- if test $exit_code -ne 0; then
- echo "ok $total - $1"
- else
- echo "not ok $total - $1"
- fi
-}
-
-skip () {
- total=$((total + 1))
- echo "ok $total - $1 # SKIP $2"
-}
+DIR="$( cd "$( dirname "${0}" )" && pwd )"
+source "${DIR}"/common.sh
# Run the examples
$gjs examples/gio-cat.js Makefile
report "run the gio-cat.js example"
+if [[ -n "${ENABLE_GTK}" ]]; then
+ timeout 5s $gjs examples/calc.js
+ report_timeout "run the calc.js example"
+
+ timeout 5s $gjs examples/gtk.js
+ report_timeout "run the gtk.js example"
+
+ timeout 5s $gjs examples/gtk-application.js
+ report_timeout "run the gtk-application.js example"
+
+ timeout 5s $gjs examples/gettext.js
+ report_timeout "run the gettext.js example"
+else
+ skip "run the calc.js example" "running without GTK"
+ skip "run the gtk.js example" "running without GTK"
+ skip "run the gtk-application.js example" "running without GTK"
+ skip "run the gettext.js example" "running without GTK"
+fi
echo "1..$total"
diff --git a/test/test-ci.sh b/test/test-ci.sh
index d3b1ecd9..b18d572d 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -2,8 +2,6 @@
function do_Set_Env(){
- do_Print_Labels 'Set Environment '
-
#Save cache on $pwd (required by artifacts)
mkdir -p "$(pwd)"/.cache
XDG_CACHE_HOME="$(pwd)"/.cache
@@ -23,8 +21,6 @@ function do_Set_Env(){
if [[ -z "${DISPLAY}" ]]; then
export DISPLAY=":0"
fi
-
- do_Print_Labels
}
function do_Get_Upstream_Master(){
@@ -60,7 +56,7 @@ function do_Compare_With_Upstream_Master(){
echo '-----------------------------------------'
diff -u0 /cwd/master-report.txt /cwd/current-report.txt || true
echo '-----------------------------------------'
- exit 3
+ exit 1
else
echo "$REMOVED_WARNINGS warning(s) were fixed."
echo "=> $1 Ok"
@@ -107,7 +103,20 @@ function do_Check_Warnings(){
echo '-----------------------------------------'
cat warnings.log || true
echo '-----------------------------------------'
- exit 4
+ exit 1
+ fi
+}
+
+function do_Check_Script_Errors(){
+
+ local total=0
+ total=$(cat scripts.log | grep 'not ok ' | awk '{total+=1}END{print total}')
+
+ if [[ $total > 0 ]]; then
+ echo '-----------------------------------------'
+ echo "### Found $total errors on scripts.log ###"
+ echo '-----------------------------------------'
+ exit 1
fi
}
@@ -196,6 +205,20 @@ elif [[ $1 == "VALGRIND" ]]; then
make check-valgrind
+elif [[ $1 == "SH_CHECKS" ]]; then
+ # It doesn't (re)build, just run the 'Tests'
+ do_Print_Labels 'Shell Scripts Check'
+ do_Set_Env
+
+ export LC_ALL=C.UTF-8
+ export LANG=C.UTF-8
+ export LANGUAGE=C.UTF-8
+
+ installed-tests/scripts/testCommandLine.sh > scripts.log
+ installed-tests/scripts/testExamples.sh >> scripts.log
+ installed-tests/scripts/testWarnings.sh >> scripts.log
+ do_Check_Script_Errors
+
elif [[ $1 == "GJS_COVERAGE" ]]; then
# It doesn't (re)build, just run the 'Coverage Tests'
do_Print_Labels 'Code Coverage Report'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]