[LNT] r309040 - admin: Improve testing and fix some bugs
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 25 15:17:12 PDT 2017
Author: matze
Date: Tue Jul 25 15:17:12 2017
New Revision: 309040
URL: http://llvm.org/viewvc/llvm-project?rev=309040&view=rev
Log:
admin: Improve testing and fix some bugs
Modified:
lnt/trunk/lnt/lnttool/admin.py
lnt/trunk/tests/lnttool/admin.shtest
Modified: lnt/trunk/lnt/lnttool/admin.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/admin.py?rev=309040&r1=309039&r2=309040&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/admin.py (original)
+++ lnt/trunk/lnt/lnttool/admin.py Tue Jul 25 15:17:12 2017
@@ -151,17 +151,8 @@ def action_get_machine(config, machine):
response = config.session.get(url)
_check_response(response)
data = json.loads(response.text)
- assert len(data['machines']) == 1
- machine = data['machines'][0]
-
- result = {
- 'machine': machine
- }
- runs = data.get('runs', None)
- if runs is not None:
- result['runs'] = runs
with open(filename, "w") as destfile:
- json.dump(result, destfile, indent=2)
+ json.dump(data, destfile, indent=2, sort_keys=True)
sys.stdout.write("%s created.\n" % filename)
@@ -222,7 +213,6 @@ def action_merge_machine_into(config, ma
url = ('{lnt_url}/api/db_{database}/v4/{testsuite}/machines/{machine}'
.format(machine=machine, **config.dict))
- session = config['session']
post_data = {
'action': 'merge',
'into': into
@@ -274,7 +264,7 @@ def action_get_run(config, runs):
data = json.loads(response.text)
filename = 'run_%s.json' % run
with open(filename, "w") as destfile:
- json.dump(data, destfile, indent=2)
+ json.dump(data, destfile, indent=2, sort_keys=True)
sys.stdout.write("%s created.\n" % filename)
@@ -322,7 +312,8 @@ def action_post_run(config, datafiles, u
if config.verbose:
try:
response_data = json.loads(response.text)
- json.dump(response_data, sys.stderr, response_data, indent=2)
+ json.dump(response_data, sys.stderr, response_data, indent=2,
+ sort_keys=True)
except:
sys.stderr.write(response.text)
sys.stderr.write('\n')
Modified: lnt/trunk/tests/lnttool/admin.shtest
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/lnttool/admin.shtest?rev=309040&r1=309039&r2=309040&view=diff
==============================================================================
--- lnt/trunk/tests/lnttool/admin.shtest (original)
+++ lnt/trunk/tests/lnttool/admin.shtest Tue Jul 25 15:17:12 2017
@@ -1,21 +1,24 @@
-# RUN: rm -f %T/lntadmin.yaml
-# RUN: cd %T ; lnt admin create-config
-# RUN: FileCheck %s < %T/lntadmin.yaml --check-prefix=CREATE_CONFIG
-# CREATE_CONFIG: lnt_url: "http://localhost:8000"
-# CREATE_CONFIG-NEXT: database: default
-# CREATE_CONFIG-NEXT: testsuite: nts
-# CREATE_CONFIG-NEXT: # user: 'http_user'
-# CREATE_CONFIG-NEXT: # password: 'http_password'
-# CREATE_CONFIG-NEXT: # auth_token: 'secret'
-
# RUN: rm -rf %t.instance
# RUN: python %{shared_inputs}/create_temp_instance.py \
# RUN: %s %{shared_inputs}/SmallInstance %t.instance
# RUN: %{shared_inputs}/server_wrapper.sh %t.instance 9092 /bin/sh %s %T %{shared_inputs}
+set -eux
DIR="$1"
SHARED_INPUTS="$2"
cd "$DIR"
+
+rm -rf lntadmin.yaml
+lnt admin create-config > create_config.stdout
+mv lntadmin.yaml create_config.txt
+# RUN: FileCheck %s --check-prefix=CREATE_CONFIG < %T/create_config.txt
+# CREATE_CONFIG: lnt_url: "http://localhost:8000"
+# CREATE_CONFIG-NEXT: database: default
+# CREATE_CONFIG-NEXT: testsuite: nts
+# CREATE_CONFIG-NEXT: # user: 'http_user'
+# CREATE_CONFIG-NEXT: # password: 'http_password'
+# CREATE_CONFIG-NEXT: # auth_token: 'secret'
+
cat > lntadmin.yaml << '__EOF__'
lnt_url: "http://localhost:9092"
database: default
@@ -27,23 +30,32 @@ lnt admin post-run "${SHARED_INPUTS}/sam
# RUN: FileCheck %s --check-prefix=POST_RN < %T/post_run.stdout
# POST_RN: http://localhost:9092/api/db_default/v4/nts/runs/3
+lnt admin machine-info 1 > machine_info.stdout
+# RUN: FileCheck %s --check-prefix=MACHINE_INFO < %T/machine_info.stdout
+# MACHINE_INFO: name: localhost__clang_DEV__x86_64
+# MACHINE_INFO: id: 1
+# MACHINE_INFO: hardware: x86_64
+# MACHINE_INFO: hostname: localhost
+# MACHINE_INFO: os: Darwin 11.3.0
+# MACHINE_INFO: uname: Darwin localhost 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
+
rm -rf run_3.json
-lnt admin get-run 3
+lnt admin get-run 3 > get_run.stdout
# RUN: FileCheck %s --check-prefix=GET_RN < %T/run_3.json
# GET_RN: {
+# GET_RN: "generated_by":
# GET_RN: "machine": {
# ...
# GET_RN: },
-# GET_RN: "tests": [
-#...
-# GET_RN: ],
# GET_RN: "run": {
-# GET_RN: "start_time": "2009-11-17T02:12:25"
-# GET_RN: "end_time": "2009-11-17T03:44:48"
-# GET_RN: "id": 3
+# GET_RN: "end_time": "2009-11-17T03:44:48",
+# GET_RN: "id": 3,
#...
+# GET_RN: "start_time": "2009-11-17T02:12:25"
# GET_RN: },
-# GET_RN: "generated_by": "LNT Server v0.4.2dev"
+# GET_RN: "tests": [
+#...
+# GET_RN: ]
# GET_RN: }
lnt admin list-machines > list_machines.stdout
@@ -56,7 +68,28 @@ lnt admin list-runs 1 > list_runs.stdout
# LIST_RUNS: llvm_project_revision=154331 1
# LIST_RUNS: llvm_project_revision=152289 2
-lnt admin rm-machine 1
+rm -rf machine_1.json
+lnt admin get-machine 1 > get_machine.stdout
+# RUN: FileCheck %s --check-prefix=GET_MACHINE_JSON < %T/machine_1.json
+# GET_MACHINE_JSON: {
+# GET_MACHINE_JSON: "generated_by":
+# GET_MACHINE_JSON: "machine": {
+# GET_MACHIEN_JSON: "hardware": "x86_64",
+# GET_MACHIEN_JSON: "hostname": "localhost",
+# GET_MACHIEN_JSON: "id": 1,
+# GET_MACHIEN_JSON: "name": "localhost__clang_DEV__x86_64",
+# GET_MACHIEN_JSON: "os": "Darwin 11.3.0",
+# GET_MACHIEN_JSON: "uname": "Darwin localhost 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
+# GET_MACHINE_JSON: },
+# GET_MACHINE_JSON: "runs": [
+# ...
+# GET_MACHINE_JSON: ]
+# GET_MACHINE_JSON: }
+
+lnt admin rm-machine 1 > rm_machine.stdout
+# RUN: FileCheck %s --check-prefix=RM_MACHINE < %T/rm_machine.stdout
+# RM_MACHINE: Deleting runs 1 2 (2/2)
+# RM_MACHINE: Deleted machine localhost__clang_DEV__x86_64:1
lnt admin list-machines > list_machines2.stdout
# RUN: FileCheck %s --check-prefix=LIST_MACHINES2 < %T/list_machines2.stdout
@@ -64,7 +97,17 @@ lnt admin list-machines > list_machines2
# LIST_MACHINES2: LNT SAMPLE MACHINE:2
lnt admin rename-machine 2 hal9000
+# No output
lnt admin list-machines > list_machines3.stdout
# RUN: FileCheck %s --check-prefix=LIST_MACHINES3 < %T/list_machines3.stdout
# LIST_MACHINES3: hal9000:2
+
+# Just post again so we have a machine to merge
+lnt admin post-run run_3.json > /dev/null
+
+lnt admin merge-machine-into 2 3 > merge_machine_into.stdout
+# No output
+
+lnt admin rm-run 4
+# No output
More information about the llvm-commits
mailing list