aboutsummaryrefslogtreecommitdiffstats
path: root/selftest
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-06 18:35:26 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-05-06 18:49:31 +0200
commitab1904a307b531dbd1c738ef04eeeeb68f9920b3 (patch)
tree665d524265171d0e977633f4c29536b9174d8364 /selftest
parent636f560dc2f26d303a0bdb7115744cb402159131 (diff)
selftest: Move tests into own subdirectories
Diffstat (limited to 'selftest')
-rw-r--r--selftest/_prep.py2
-rwxr-xr-xselftest/all_tests.py18
l---------selftest/cdf_test/_prep.py1
-rw-r--r--selftest/cdf_test/cdf_test.ok (renamed from selftest/cdf_test.ok)0
-rwxr-xr-xselftest/cdf_test/cdf_test.py (renamed from selftest/cdf_test.py)0
l---------selftest/config_test/_prep.py1
-rw-r--r--selftest/config_test/config_test.err (renamed from selftest/config_test.err)0
-rw-r--r--selftest/config_test/config_test.ok (renamed from selftest/config_test.ok)0
-rwxr-xr-xselftest/config_test/config_test.py (renamed from selftest/config_test.py)2
l---------selftest/lock_test/_prep.py1
-rw-r--r--selftest/lock_test/lock_test.err (renamed from selftest/lock_test.err)0
-rw-r--r--selftest/lock_test/lock_test.ok (renamed from selftest/lock_test.ok)0
-rwxr-xr-xselftest/lock_test/lock_test.sh (renamed from selftest/lock_test.sh)6
-rw-r--r--selftest/lock_test/lock_test_help.py (renamed from selftest/lock_test_help.py)0
l---------selftest/log_test/_prep.py1
-rw-r--r--selftest/log_test/log_test.err (renamed from selftest/log_test.err)0
-rw-r--r--selftest/log_test/log_test.ok (renamed from selftest/log_test.ok)0
-rwxr-xr-xselftest/log_test/log_test.py (renamed from selftest/log_test.py)0
l---------selftest/process_test/_prep.py1
-rw-r--r--selftest/process_test/process_test.err (renamed from selftest/process_test.err)0
-rw-r--r--selftest/process_test/process_test.ok (renamed from selftest/process_test.ok)0
-rw-r--r--selftest/process_test/process_test.ok.ign (renamed from selftest/process_test.ok.ign)0
-rwxr-xr-xselftest/process_test/process_test.py (renamed from selftest/process_test.py)0
l---------selftest/resource_test/_prep.py1
-rw-r--r--selftest/resource_test/conf/paths.conf (renamed from selftest/conf/paths.conf)0
-rw-r--r--selftest/resource_test/conf/resources.conf (renamed from selftest/conf/resources.conf)0
-rw-r--r--selftest/resource_test/resource_test.err (renamed from selftest/resource_test.err)0
-rw-r--r--selftest/resource_test/resource_test.ok (renamed from selftest/resource_test.ok)12
-rw-r--r--selftest/resource_test/resource_test.ok.ign (renamed from selftest/resource_test.ok.ign)0
-rwxr-xr-xselftest/resource_test/resource_test.py (renamed from selftest/resource_test.py)3
l---------selftest/sms_test/_prep.py1
-rw-r--r--selftest/sms_test/sms_test.err (renamed from selftest/sms_test.err)0
-rw-r--r--selftest/sms_test/sms_test.ok (renamed from selftest/sms_test.ok)0
-rwxr-xr-xselftest/sms_test/sms_test.py (renamed from selftest/sms_test.py)0
l---------selftest/suite_test/_prep.py1
-rw-r--r--selftest/suite_test/suite_test.err (renamed from selftest/suite_test.err)0
-rw-r--r--selftest/suite_test/suite_test.ok (renamed from selftest/suite_test.ok)0
-rw-r--r--selftest/suite_test/suite_test.ok.ign (renamed from selftest/suite_test.ok.ign)0
-rwxr-xr-xselftest/suite_test/suite_test.py (renamed from selftest/suite_test.py)0
l---------selftest/template_test/_prep.py1
-rw-r--r--selftest/template_test/template_test.err (renamed from selftest/template_test.err)0
-rw-r--r--selftest/template_test/template_test.ok (renamed from selftest/template_test.ok)0
-rwxr-xr-xselftest/template_test/template_test.py (renamed from selftest/template_test.py)0
l---------selftest/trial_test/_prep.py1
-rw-r--r--selftest/trial_test/trial_test.err (renamed from selftest/trial_test.err)0
-rw-r--r--selftest/trial_test/trial_test.ok (renamed from selftest/trial_test.ok)0
-rw-r--r--selftest/trial_test/trial_test.ok.ign (renamed from selftest/trial_test.ok.ign)0
-rwxr-xr-xselftest/trial_test/trial_test.py (renamed from selftest/trial_test.py)0
l---------selftest/util_test/_prep.py1
-rw-r--r--selftest/util_test/util_test.err (renamed from selftest/util_test.err)0
-rw-r--r--selftest/util_test/util_test.ok (renamed from selftest/util_test.ok)0
-rwxr-xr-xselftest/util_test/util_test.py (renamed from selftest/util_test.py)0
52 files changed, 37 insertions, 17 deletions
diff --git a/selftest/_prep.py b/selftest/_prep.py
index 582b8fb..773f190 100644
--- a/selftest/_prep.py
+++ b/selftest/_prep.py
@@ -1,7 +1,7 @@
import sys, os
script_dir = sys.path[0]
-top_dir = os.path.join(script_dir, '..')
+top_dir = os.path.join(script_dir, '..', '..')
src_dir = os.path.join(top_dir, 'src')
# to find the osmo_gsm_tester py module
diff --git a/selftest/all_tests.py b/selftest/all_tests.py
index 5c1ce59..bb00793 100755
--- a/selftest/all_tests.py
+++ b/selftest/all_tests.py
@@ -72,14 +72,20 @@ def verify_output(got, expect_file, update=False):
script_dir = sys.path[0]
tests = []
-for f in os.listdir(script_dir):
- file_path = os.path.join(script_dir, f)
- if not os.path.isfile(file_path):
+for d in os.listdir(script_dir):
+ dir_path = os.path.join(script_dir, d)
+ if not os.path.isdir(dir_path):
continue
-
- if not (file_path.endswith('_test.py') or file_path.endswith('_test.sh')):
+ if not dir_path.endswith('_test'):
continue
- tests.append(file_path)
+ for f in os.listdir(dir_path):
+ file_path = os.path.join(script_dir, d, f)
+ if not os.path.isfile(file_path):
+ continue
+
+ if not (file_path.endswith('_test.py') or file_path.endswith('_test.sh')):
+ continue
+ tests.append(file_path)
ran = []
errors = []
diff --git a/selftest/cdf_test/_prep.py b/selftest/cdf_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/cdf_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/cdf_test.ok b/selftest/cdf_test/cdf_test.ok
index aa753e4..aa753e4 100644
--- a/selftest/cdf_test.ok
+++ b/selftest/cdf_test/cdf_test.ok
diff --git a/selftest/cdf_test.py b/selftest/cdf_test/cdf_test.py
index 8d837c1..8d837c1 100755
--- a/selftest/cdf_test.py
+++ b/selftest/cdf_test/cdf_test.py
diff --git a/selftest/config_test/_prep.py b/selftest/config_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/config_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/config_test.err b/selftest/config_test/config_test.err
index e69de29..e69de29 100644
--- a/selftest/config_test.err
+++ b/selftest/config_test/config_test.err
diff --git a/selftest/config_test.ok b/selftest/config_test/config_test.ok
index e1fb87d..e1fb87d 100644
--- a/selftest/config_test.ok
+++ b/selftest/config_test/config_test.ok
diff --git a/selftest/config_test.py b/selftest/config_test/config_test.py
index c26ebd1..797553d 100755
--- a/selftest/config_test.py
+++ b/selftest/config_test/config_test.py
@@ -11,7 +11,7 @@ import copy
from osmo_gsm_tester.core import config, log, schema
example_config_file = 'test.cfg'
-example_config = os.path.join(_prep.script_dir, 'config_test', example_config_file)
+example_config = os.path.join(_prep.script_dir, example_config_file)
cfg = config.read(example_config)
pprint.pprint(cfg, width=81)
diff --git a/selftest/lock_test/_prep.py b/selftest/lock_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/lock_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/lock_test.err b/selftest/lock_test/lock_test.err
index e69de29..e69de29 100644
--- a/selftest/lock_test.err
+++ b/selftest/lock_test/lock_test.err
diff --git a/selftest/lock_test.ok b/selftest/lock_test/lock_test.ok
index 011a89c..011a89c 100644
--- a/selftest/lock_test.ok
+++ b/selftest/lock_test/lock_test.ok
diff --git a/selftest/lock_test.sh b/selftest/lock_test/lock_test.sh
index 4f3f7ad..9e4f44a 100755
--- a/selftest/lock_test.sh
+++ b/selftest/lock_test/lock_test.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+owndir="$(dirname -- "$0")"
+
echo 'creating files'
dir="$(mktemp -d)"
n1="long name"
@@ -11,7 +13,7 @@ touch "$f2"
sync
echo 'launch a program that locks a given file, it will create $dir/lock_test'
-python3 ./lock_test_help.py "$dir" "$n1" &
+python3 $owndir/lock_test_help.py "$dir" "$n1" &
echo 'wait until this lock_test lock file was created by program'
while [ ! -f "$dir/lock_test" ]; do
@@ -23,7 +25,7 @@ echo 'expecting the lock file to reflect "long name"'
echo "launched first, locked by: '$(cat "$dir/lock_test")'"
echo 'launching second program, should find the lock intact and wait'
-python3 ./lock_test_help.py "$dir" "$n2" &
+python3 $owndir/lock_test_help.py "$dir" "$n2" &
while [ ! -f "$f2.ready" ]; do
sleep .1
done
diff --git a/selftest/lock_test_help.py b/selftest/lock_test/lock_test_help.py
index d68bbf8..d68bbf8 100644
--- a/selftest/lock_test_help.py
+++ b/selftest/lock_test/lock_test_help.py
diff --git a/selftest/log_test/_prep.py b/selftest/log_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/log_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/log_test.err b/selftest/log_test/log_test.err
index e69de29..e69de29 100644
--- a/selftest/log_test.err
+++ b/selftest/log_test/log_test.err
diff --git a/selftest/log_test.ok b/selftest/log_test/log_test.ok
index c9d2dd2..c9d2dd2 100644
--- a/selftest/log_test.ok
+++ b/selftest/log_test/log_test.ok
diff --git a/selftest/log_test.py b/selftest/log_test/log_test.py
index f6ce02b..f6ce02b 100755
--- a/selftest/log_test.py
+++ b/selftest/log_test/log_test.py
diff --git a/selftest/process_test/_prep.py b/selftest/process_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/process_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/process_test.err b/selftest/process_test/process_test.err
index e69de29..e69de29 100644
--- a/selftest/process_test.err
+++ b/selftest/process_test/process_test.err
diff --git a/selftest/process_test.ok b/selftest/process_test/process_test.ok
index e40a461..e40a461 100644
--- a/selftest/process_test.ok
+++ b/selftest/process_test/process_test.ok
diff --git a/selftest/process_test.ok.ign b/selftest/process_test/process_test.ok.ign
index b817f5a..b817f5a 100644
--- a/selftest/process_test.ok.ign
+++ b/selftest/process_test/process_test.ok.ign
diff --git a/selftest/process_test.py b/selftest/process_test/process_test.py
index de4f7a6..de4f7a6 100755
--- a/selftest/process_test.py
+++ b/selftest/process_test/process_test.py
diff --git a/selftest/resource_test/_prep.py b/selftest/resource_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/resource_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/conf/paths.conf b/selftest/resource_test/conf/paths.conf
index 0b2d035..0b2d035 100644
--- a/selftest/conf/paths.conf
+++ b/selftest/resource_test/conf/paths.conf
diff --git a/selftest/conf/resources.conf b/selftest/resource_test/conf/resources.conf
index 84d0ab9..84d0ab9 100644
--- a/selftest/conf/resources.conf
+++ b/selftest/resource_test/conf/resources.conf
diff --git a/selftest/resource_test.err b/selftest/resource_test/resource_test.err
index e69de29..e69de29 100644
--- a/selftest/resource_test.err
+++ b/selftest/resource_test/resource_test.err
diff --git a/selftest/resource_test.ok b/selftest/resource_test/resource_test.ok
index 6147408..bbdbc5b 100644
--- a/selftest/resource_test.ok
+++ b/selftest/resource_test/resource_test.ok
@@ -9,12 +9,12 @@ The requested resource requirements are not solvable [[0, 2], [2], [0, 2]]
ok, caused exception RuntimeError: Refusing to drop a list of resources from itself. This is probably a bug where a list of Resources() should have been copied but is passed as-is. use Resources.clear() instead.
- test removing a Resources list from one with the same list in it
- test resources config and state dir:
-cnf -: DBG: Found config file paths.conf as [PATH]/selftest/conf/paths.conf in ./conf which is [PATH]/selftest/conf
-cnf -: DBG: [PATH]/selftest/conf/paths.conf: relative path ./test_work/state_dir is [PATH]/selftest/conf/test_work/state_dir
-cnf -: DBG: [PATH]/selftest/conf/paths.conf: relative path ./suite_test is [PATH]/selftest/conf/suite_test
-cnf -: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/state_dir
-cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/conf/resources.conf in ./conf which is [PATH]/selftest/conf
-cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/state_dir
+cnf -: DBG: Found config file paths.conf as [PATH]/selftest/resource_test/conf/paths.conf in [PATH]/selftest/resource_test/conf which is [PATH]/selftest/resource_test/conf
+cnf -: DBG: [PATH]/selftest/resource_test/conf/paths.conf: relative path ./test_work/state_dir is [PATH]/selftest/resource_test/conf/test_work/state_dir
+cnf -: DBG: [PATH]/selftest/resource_test/conf/paths.conf: relative path ./suite_test is [PATH]/selftest/resource_test/conf/suite_test
+cnf -: DBG: Found path state_dir as [PATH]/selftest/resource_test/conf/test_work/state_dir
+cnf ResourcesPool: DBG: Found config file resources.conf as [PATH]/selftest/resource_test/conf/resources.conf in [PATH]/selftest/resource_test/conf which is [PATH]/selftest/resource_test/conf
+cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/resource_test/conf/test_work/state_dir
*** all resources:
{'arfcn': [{'_hash': 'e620569450f8259b3f0212ec19c285dd07df063c',
'arfcn': '512',
diff --git a/selftest/resource_test.ok.ign b/selftest/resource_test/resource_test.ok.ign
index 393ce95..393ce95 100644
--- a/selftest/resource_test.ok.ign
+++ b/selftest/resource_test/resource_test.ok.ign
diff --git a/selftest/resource_test.py b/selftest/resource_test/resource_test.py
index 3f7cd51..39a7eb6 100755
--- a/selftest/resource_test.py
+++ b/selftest/resource_test/resource_test.py
@@ -2,6 +2,7 @@
import tempfile
import os
+import sys
import pprint
import shutil
import atexit
@@ -12,7 +13,7 @@ from osmo_gsm_tester.core.schema import generate_schemas
workdir = util.get_tempdir()
# override config locations to make sure we use only the test conf
-config.ENV_CONF = './conf'
+config.ENV_CONF = os.path.join(os.path.dirname(sys.argv[0]), 'conf')
log.get_process_id = lambda: '123-1490837279'
diff --git a/selftest/sms_test/_prep.py b/selftest/sms_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/sms_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/sms_test.err b/selftest/sms_test/sms_test.err
index e69de29..e69de29 100644
--- a/selftest/sms_test.err
+++ b/selftest/sms_test/sms_test.err
diff --git a/selftest/sms_test.ok b/selftest/sms_test/sms_test.ok
index 125b5c0..125b5c0 100644
--- a/selftest/sms_test.ok
+++ b/selftest/sms_test/sms_test.ok
diff --git a/selftest/sms_test.py b/selftest/sms_test/sms_test.py
index c78e76c..c78e76c 100755
--- a/selftest/sms_test.py
+++ b/selftest/sms_test/sms_test.py
diff --git a/selftest/suite_test/_prep.py b/selftest/suite_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/suite_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/suite_test.err b/selftest/suite_test/suite_test.err
index e69de29..e69de29 100644
--- a/selftest/suite_test.err
+++ b/selftest/suite_test/suite_test.err
diff --git a/selftest/suite_test.ok b/selftest/suite_test/suite_test.ok
index 908f24f..908f24f 100644
--- a/selftest/suite_test.ok
+++ b/selftest/suite_test/suite_test.ok
diff --git a/selftest/suite_test.ok.ign b/selftest/suite_test/suite_test.ok.ign
index 9bd168f..9bd168f 100644
--- a/selftest/suite_test.ok.ign
+++ b/selftest/suite_test/suite_test.ok.ign
diff --git a/selftest/suite_test.py b/selftest/suite_test/suite_test.py
index de5c6df..de5c6df 100755
--- a/selftest/suite_test.py
+++ b/selftest/suite_test/suite_test.py
diff --git a/selftest/template_test/_prep.py b/selftest/template_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/template_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/template_test.err b/selftest/template_test/template_test.err
index e69de29..e69de29 100644
--- a/selftest/template_test.err
+++ b/selftest/template_test/template_test.err
diff --git a/selftest/template_test.ok b/selftest/template_test/template_test.ok
index 88b77b0..88b77b0 100644
--- a/selftest/template_test.ok
+++ b/selftest/template_test/template_test.ok
diff --git a/selftest/template_test.py b/selftest/template_test/template_test.py
index 747d508..747d508 100755
--- a/selftest/template_test.py
+++ b/selftest/template_test/template_test.py
diff --git a/selftest/trial_test/_prep.py b/selftest/trial_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/trial_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/trial_test.err b/selftest/trial_test/trial_test.err
index e69de29..e69de29 100644
--- a/selftest/trial_test.err
+++ b/selftest/trial_test/trial_test.err
diff --git a/selftest/trial_test.ok b/selftest/trial_test/trial_test.ok
index 8c6a567..8c6a567 100644
--- a/selftest/trial_test.ok
+++ b/selftest/trial_test/trial_test.ok
diff --git a/selftest/trial_test.ok.ign b/selftest/trial_test/trial_test.ok.ign
index 1a969de..1a969de 100644
--- a/selftest/trial_test.ok.ign
+++ b/selftest/trial_test/trial_test.ok.ign
diff --git a/selftest/trial_test.py b/selftest/trial_test/trial_test.py
index a99428a..a99428a 100755
--- a/selftest/trial_test.py
+++ b/selftest/trial_test/trial_test.py
diff --git a/selftest/util_test/_prep.py b/selftest/util_test/_prep.py
new file mode 120000
index 0000000..9cea3fe
--- /dev/null
+++ b/selftest/util_test/_prep.py
@@ -0,0 +1 @@
+../_prep.py \ No newline at end of file
diff --git a/selftest/util_test.err b/selftest/util_test/util_test.err
index e69de29..e69de29 100644
--- a/selftest/util_test.err
+++ b/selftest/util_test/util_test.err
diff --git a/selftest/util_test.ok b/selftest/util_test/util_test.ok
index c2c5f87..c2c5f87 100644
--- a/selftest/util_test.ok
+++ b/selftest/util_test/util_test.ok
diff --git a/selftest/util_test.py b/selftest/util_test/util_test.py
index e07b2d4..e07b2d4 100755
--- a/selftest/util_test.py
+++ b/selftest/util_test/util_test.py