[LNT] r249697 - Fix submission of reports through instance rather than url.
Kristof Beyls via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 8 09:11:58 PDT 2015
Author: kbeyls
Date: Thu Oct 8 11:11:58 2015
New Revision: 249697
URL: http://llvm.org/viewvc/llvm-project?rev=249697&view=rev
Log:
Fix submission of reports through instance rather than url.
This regression was introduced in r248789, but wasn't caught earlier as there
wasn't a regression test for submitting reports by pointing to a server
instance directory rather than to a server instance URL. This commit also
introduces such a regression test.
Modified:
lnt/trunk/lnt/util/ServerUtil.py
lnt/trunk/tests/runtest/Inputs/runtest_server_wrapper.sh
lnt/trunk/tests/runtest/nt.py
lnt/trunk/tests/runtest/rerun.py
Modified: lnt/trunk/lnt/util/ServerUtil.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ServerUtil.py?rev=249697&r1=249696&r2=249697&view=diff
==============================================================================
--- lnt/trunk/lnt/util/ServerUtil.py (original)
+++ lnt/trunk/lnt/util/ServerUtil.py Thu Oct 8 11:11:58 2015
@@ -6,6 +6,7 @@ import plistlib
import sys
import urllib
import urllib2
+import contextlib
import lnt.server.instance
from lnt.util import json
@@ -45,7 +46,7 @@ def submitFileToInstance(path, file, com
instance = lnt.server.instance.Instance.frompath(path)
config = instance.config
db_name = 'default'
- with closing(config.get_database(db_name)) as db:
+ with contextlib.closing(config.get_database(db_name)) as db:
if db is None:
raise ValueError("no default database in instance: %r" % (path,))
return lnt.util.ImportData.import_and_report(
Modified: lnt/trunk/tests/runtest/Inputs/runtest_server_wrapper.sh
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/Inputs/runtest_server_wrapper.sh?rev=249697&r1=249696&r2=249697&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/Inputs/runtest_server_wrapper.sh (original)
+++ lnt/trunk/tests/runtest/Inputs/runtest_server_wrapper.sh Thu Oct 8 11:11:58 2015
@@ -2,18 +2,16 @@
# This script wraps a call to lnt runtest with a local server
# instance. It is intended for testing full runtest invocations
# that need a real server instnace to work.
-# ./runtest_server_wrapper <location of server files> <runtest type> [arguments for lnt runtest]
+# ./runtest_server_wrapper <location of server files> <runtest type> <submit-through-url> <portnr> [arguments for lnt runtest]
# ./runtest_server_wrapper /tmp/ nt --cc /bin/clang --sandbox /tmp/sandbox
# First launch the server.
-# TODO: we can't run the tests in parrelle unless we do something smart
-# with this port.
PROGRAM="$(basename $0)"
usage() {
- echo "usage: $PROGRAM <location of server files> <runtest type> [arguments for lnt runtest]"
- echo "e.g: $PROGRAM /tmp/ nt --cc /bin/clang --sandbox /tmp/sandbox"
+ echo "usage: $PROGRAM <location of server files> <runtest type> <submit-through-url> <portnr> [arguments for lnt runtest]"
+ echo "e.g: $PROGRAM /tmp/ nt yes --cc /bin/clang --sandbox /tmp/sandbox"
}
error() {
@@ -26,11 +24,22 @@ main() {
[ $# -lt 2 ] &&
error "not enough arguments"
- lnt runserver $1 --hostname localhost --port 9090 &
+ local serverinstance=$1
+ local portnr=$4
+ lnt runserver $serverinstance --hostname localhost --port $portnr &
local pid=$!
local type=$2
- shift 2
- lnt runtest $type --submit http://localhost:9090/db_default/submitRun $@
+ local submit_through_url=$3
+ shift 4
+ case $submit_through_url in
+ [yY][eE][sS]|[yY])
+ submit_pointer=http://localhost:$portnr/db_default/submitRun
+ ;;
+ *)
+ submit_pointer=$serverinstance
+ ;;
+ esac
+ lnt runtest $type --submit $submit_pointer $@
local rc=$?
kill -15 $pid
@@ -42,4 +51,4 @@ main() {
exit $rc
}
-main "$@"
\ No newline at end of file
+main "$@"
Modified: lnt/trunk/tests/runtest/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/nt.py?rev=249697&r1=249696&r2=249697&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/nt.py (original)
+++ lnt/trunk/tests/runtest/nt.py Thu Oct 8 11:11:58 2015
@@ -147,3 +147,43 @@
# RUN: --no-timestamp > %t.log 2> %t.err
# RUN: FileCheck --check-prefix CHECK-QEMU-FLAG1 < %t.err %s
# CHECK-QEMU-FLAG1: QEMU_USER_MODE_COMMAND: TEST -soundhw gus -net nic -device gus,irq=5 '-test=escaped space' '-some-option=stay with me'
+
+# Check submission to a server through url works:
+# RUN: rsync -av --exclude .svn %S/Inputs/rerun_server_instance/ \
+# RUN: %{test_exec_root}/runtest/nt_server_instance
+# RUN: %S/Inputs/runtest_server_wrapper.sh \
+# RUN: %{test_exec_root}/runtest/nt_server_instance nt yes 9089 \
+# RUN: --sandbox %t.SANDBOX \
+# RUN: --test-suite %S/Inputs/rerun-test-suite1 \
+# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN: --no-timestamp --rerun --run-order 1 > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-SUBMIT-STDOUT < %t.log %s
+# RUN: FileCheck --check-prefix CHECK-SUBMIT-STDERR < %t.err %s
+
+# CHECK-SUBMIT-STDOUT: Import succeeded.
+# CHECK-SUBMIT-STDOUT: Added Runs : 1
+
+# CHECK-SUBMIT-STDERR: inferred C++ compiler under test
+# CHECK-SUBMIT-STDERR: checking source versions
+# CHECK-SUBMIT-STDERR: using nickname
+# CHECK-SUBMIT-STDERR: starting test
+# CHECK-SUBMIT-STDERR: configuring
+# CHECK-SUBMIT-STDERR: building test-suite tools
+# CHECK-SUBMIT-STDERR: executing "nightly tests" with -j1
+# CHECK-SUBMIT-STDERR: loading nightly test data
+# CHECK-SUBMIT-STDERR: capturing machine information
+# CHECK-SUBMIT-STDERR: generating report
+# CHECK-SUBMIT-STDERR: submitting result to
+# CHECK-SUBMIT-STDERR: note: Rerunning 0 of 69 benchmarks.
+
+# Check submission to a server through server instance works:
+# RUN: rsync -av --exclude .svn %S/Inputs/rerun_server_instance/ \
+# RUN: %{test_exec_root}/runtest/nt_server_instance
+# RUN: %S/Inputs/runtest_server_wrapper.sh \
+# RUN: %{test_exec_root}/runtest/nt_server_instance nt no 9089 \
+# RUN: --sandbox %t.SANDBOX \
+# RUN: --test-suite %S/Inputs/rerun-test-suite1 \
+# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
+# RUN: --no-timestamp --rerun --run-order 1 > %t.log 2> %t.err
+# RUN: FileCheck --check-prefix CHECK-SUBMIT-STDOUT < %t.log %s
+# RUN: FileCheck --check-prefix CHECK-SUBMIT-STDERR < %t.err %s
Modified: lnt/trunk/tests/runtest/rerun.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/rerun.py?rev=249697&r1=249696&r2=249697&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/rerun.py (original)
+++ lnt/trunk/tests/runtest/rerun.py Thu Oct 8 11:11:58 2015
@@ -8,7 +8,7 @@
# RUN: %{test_exec_root}/runtest/rerun_server_instance
# RUN: rm -f CHECK-STDOUT CHECK-STDOUT2 CHECK-STDERR CHECK-STDERR2
# RUN: %S/Inputs/runtest_server_wrapper.sh \
-# RUN: %{test_exec_root}/runtest/rerun_server_instance nt \
+# RUN: %{test_exec_root}/runtest/rerun_server_instance nt yes 9090 \
# RUN: --sandbox %t.SANDBOX \
# RUN: --test-suite %S/Inputs/rerun-test-suite1 \
# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
@@ -33,7 +33,7 @@
# CHECK-STDERR: note: Rerunning 0 of 69 benchmarks.
# RUN: %S/Inputs/runtest_server_wrapper.sh \
-# RUN: %{test_exec_root}/runtest/rerun_server_instance nt \
+# RUN: %{test_exec_root}/runtest/rerun_server_instance nt yes 9090 \
# RUN: --sandbox %t.SANDBOX2 \
# RUN: --test-suite %S/Inputs/rerun-test-suite2 \
# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
More information about the llvm-commits
mailing list