aboutsummaryrefslogtreecommitdiffstats
path: root/selftest
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-25 19:49:29 +0200
committerpespin <pespin@sysmocom.de>2020-05-28 13:13:05 +0000
commit6e0b6fb0747b045e97e915e9ff9aeeb80c4c7f40 (patch)
tree5fc6ba39293f1b820d8790e7f9e1dd7597c412de /selftest
parent2e495749d5cf3bbe8329ce46a930b63d8f706042 (diff)
Support identifying different tgz files based on run_label attribute
tgz files in trials can be categorized in subdirectories, allowing to select different bianry files at runtime based on the target run node which is going to run them. This way for instance one can have a binary linked against libs for eg. CentOS under run_label "centos/" or an ARM target under "arm", and then use "run_label: arm" on the resource using it. Change-Id: Iaf2e97da3aff693395f44f0e93b184d4846cf6da
Diffstat (limited to 'selftest')
-rw-r--r--selftest/Makefile1
-rw-r--r--selftest/trial_test/run_label/checksums.md52
-rw-r--r--selftest/trial_test/run_label/foobar/sample.tar.gzbin0 -> 131 bytes
-rw-r--r--selftest/trial_test/run_label/sample.tar.gzbin0 -> 128 bytes
-rw-r--r--selftest/trial_test/trial_test.ok9
-rw-r--r--selftest/trial_test/trial_test.ok.ign2
-rwxr-xr-xselftest/trial_test/trial_test.py17
7 files changed, 29 insertions, 2 deletions
diff --git a/selftest/Makefile b/selftest/Makefile
index fb8618c..53d882c 100644
--- a/selftest/Makefile
+++ b/selftest/Makefile
@@ -12,6 +12,7 @@ set_pythonpath:
clean:
@find . -name "*__pycache__" -type d -print0 | xargs -0 rm -rvf
@find . -name "*test_work" -type d -print0 | xargs -0 rm -rvf
+ @rm -rfv ./trial_test/run_label/inst
@rm -fv ./set_pythonpath
# vim: noexpandtab tabstop=8 shiftwidth=8
diff --git a/selftest/trial_test/run_label/checksums.md5 b/selftest/trial_test/run_label/checksums.md5
new file mode 100644
index 0000000..a162c56
--- /dev/null
+++ b/selftest/trial_test/run_label/checksums.md5
@@ -0,0 +1,2 @@
+b13c9c94d41c45caaa08ad9ad3ee0f11 sample.tar.gz
+430ec62329747b5f15fe6e2cb141b909 foobar/sample.tar.gz
diff --git a/selftest/trial_test/run_label/foobar/sample.tar.gz b/selftest/trial_test/run_label/foobar/sample.tar.gz
new file mode 100644
index 0000000..2c1b029
--- /dev/null
+++ b/selftest/trial_test/run_label/foobar/sample.tar.gz
Binary files differ
diff --git a/selftest/trial_test/run_label/sample.tar.gz b/selftest/trial_test/run_label/sample.tar.gz
new file mode 100644
index 0000000..3932964
--- /dev/null
+++ b/selftest/trial_test/run_label/sample.tar.gz
Binary files differ
diff --git a/selftest/trial_test/trial_test.ok b/selftest/trial_test/trial_test.ok
index 8c6a567..75bd1a7 100644
--- a/selftest/trial_test/trial_test.ok
+++ b/selftest/trial_test/trial_test.ok
@@ -14,3 +14,12 @@ None
ok, got RuntimeError: Checksum mismatch for '[PATH]/trial_test/invalid_checksum/file2' vs. '[PATH]/trial_test/invalid_checksum/checksums.md5' line 2
- detect missing file
ok, got RuntimeError: File listed in checksums file but missing in trials dir: '[PATH]/trial_test/missing_file/file2' vs. '[PATH]/trial_test/missing_file/checksums.md5' line 2
+- Verify trials based on run_label
+tst run_label: DBG: has bin_tar {bin_name='sample', matches=['sample.tar.gz'], run_label='foobar'}
+inst: [PATH]/trial_test/run_label/inst/foobar/sample
+content file2: subhello
+
+tst run_label: DBG: has bin_tar {bin_name='sample', matches=['sample.tar.gz'], run_label=''}
+inst: [PATH]/trial_test/run_label/inst/sample
+content file1: hello
+
diff --git a/selftest/trial_test/trial_test.ok.ign b/selftest/trial_test/trial_test.ok.ign
index 1a969de..46c3943 100644
--- a/selftest/trial_test/trial_test.ok.ign
+++ b/selftest/trial_test/trial_test.ok.ign
@@ -1,3 +1,3 @@
/tmp/[^/]* [TMP]
....-..-.._..-..-.. [TIMESTAMP]
-'[^']*/trial_test '[PATH]/trial_test
+/[^ ]*/trial_test/ [PATH]/trial_test/
diff --git a/selftest/trial_test/trial_test.py b/selftest/trial_test/trial_test.py
index a99428a..cf91a85 100755
--- a/selftest/trial_test/trial_test.py
+++ b/selftest/trial_test/trial_test.py
@@ -1,8 +1,10 @@
#!/usr/bin/env python3
-import time
import _prep
+
+import time
import os
+
from osmo_gsm_tester.core import util
from osmo_gsm_tester.core.trial import Trial
@@ -46,4 +48,17 @@ try:
except RuntimeError as e:
print('ok, got RuntimeError: %s' % str(e))
+print('- Verify trials based on run_label')
+d = util.Dir('trial_test')
+t = Trial(d.child('run_label'))
+t.verify()
+inst = util.Dir(t.get_inst('sample', 'foobar'))
+print('inst: ' + str(inst))
+with open(inst.child('file2'), 'r') as f:
+ print('content file2: %s' % f.read())
+inst = util.Dir( t.get_inst('sample'))
+print('inst: ' + str(inst))
+with open(inst.child('file1'), 'r') as f:
+ print('content file1: %s' % f.read())
+
# vim: expandtab tabstop=4 shiftwidth=4