Skip to content

Commit 2cd2c57

Browse files
Tóth Bélartakacs
authored andcommitted
Enable the usage of user provided testsuite (#216)
Added a new argument `--testsuite <path>` which points to a directory containing tests or testsets. JSRemoteTest-DCO-1.0-Signed-off-by: Bela Toth [email protected]
1 parent 3a133bf commit 2cd2c57

File tree

8 files changed

+27
-26
lines changed

8 files changed

+27
-26
lines changed

jstest/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ def create_testing_environment(user_options, job_options):
8686
if options.app_path:
8787
modules[options.app].src = options.app_path
8888

89+
if options.testsuite:
90+
modules[options.app].paths.tests = options.testsuite
91+
8992
# Add an 'app' named module that is just a reference
9093
# to the user defined target application.
9194
modules.app = modules[options.app]

jstest/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ def parse_options():
8787
default=False, action='store_true',
8888
help='emulate the connection')
8989

90+
parser.add_argument('--testsuite',
91+
metavar='TEST_SUITE_PATH',
92+
help='specify the path to user-owned tests')
93+
9094
group = parser.add_argument_group("Secure Shell communication")
9195

9296
group.add_argument('--username',

jstest/builder/modules/iotjs.build.config

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"init": [
44
{
55
"cmd": "function(genromfs)",
6-
"args": ["%{iotjs}/test", "%{nuttx-apps}/nshlib/nsh_romfsimg.h"]
6+
"args": ["%{testsuite}", "%{nuttx-apps}/nshlib/nsh_romfsimg.h"]
77
},
88
{
99
"cmd": "function(push_environment)",
@@ -60,7 +60,7 @@
6060
"dst": "%{build-dir}/libs"
6161
},
6262
{
63-
"src": "%{iotjs}/test",
63+
"src": "%{testsuite}",
6464
"dst": "%{build-dir}/tests"
6565
}
6666
]
@@ -128,7 +128,7 @@
128128
"dst": "%{build-dir}/libs"
129129
},
130130
{
131-
"src": "%{iotjs}/test",
131+
"src": "%{testsuite}",
132132
"dst": "%{build-dir}/tests"
133133
}
134134
]
@@ -203,7 +203,7 @@
203203
"dst": "%{build-dir}/linker.map"
204204
},
205205
{
206-
"src": "%{iotjs}/test",
206+
"src": "%{testsuite}",
207207
"dst": "%{build-dir}/tests"
208208
},
209209
{
@@ -279,7 +279,7 @@
279279
"dst": "%{build-dir}/linker.map"
280280
},
281281
{
282-
"src": "%{iotjs}/test",
282+
"src": "%{testsuite}",
283283
"dst": "%{build-dir}/tests"
284284
},
285285
{

jstest/builder/modules/jerryscript.build.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"init": [
44
{
55
"cmd": "function(genromfs)",
6-
"args": ["%{jerryscript}/tests/jerry/", "%{nuttx-apps}/nshlib/nsh_romfsimg.h"]
6+
"args": ["%{testsuite}/", "%{nuttx-apps}/nshlib/nsh_romfsimg.h"]
77
},
88
{
99
"cmd": "function(push_environment)",
@@ -44,7 +44,7 @@
4444
"dst": "%{build-dir}/libs"
4545
},
4646
{
47-
"src": "%{jerryscript}/tests/jerry",
47+
"src": "testsuite",
4848
"dst": "%{build-dir}/tests"
4949
}
5050
]
@@ -93,7 +93,7 @@
9393
"dst": "%{build-dir}/libs"
9494
},
9595
{
96-
"src": "%{jerryscript}/tests/jerry",
96+
"src": "%{testsuite}",
9797
"dst": "%{build-dir}/tests"
9898
}
9999
]
@@ -149,7 +149,7 @@
149149
"dst": "%{build-dir}/linker.map"
150150
},
151151
{
152-
"src": "%{jerryscript}/tests/jerry",
152+
"src": "%{testsuite}",
153153
"dst": "%{build-dir}/tests"
154154
},
155155
{

jstest/common/symbol_resolver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def resolve_symbol(symbol, env):
118118
'coverage': bool(env.options.coverage),
119119
'minimal-profile-build': 'minimal-profile-build' in env.options.id,
120120
'test-build': 'test-build' in env.options.id,
121-
'build-dir': env.paths.builddir
121+
'build-dir': env.paths.builddir,
122+
'testsuite': env.modules.app.paths.tests
122123
}
123124

124125
return symbol_table.get(symbol, None)

jstest/resources/resources.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,7 @@
3737
},
3838
"config": [
3939
{
40-
"condition": "'%{appname}' == 'iotjs'",
41-
"src": "%{iotjs}/test",
42-
"dst": "%{tizenrt}/tools/fs/contents/"
43-
},
44-
{
45-
"condition": "'%{appname}' == 'jerryscript'",
46-
"src": "%{jerryscript}/tests/jerry",
40+
"src": "%{testsuite}",
4741
"dst": "%{tizenrt}/tools/fs/contents/"
4842
},
4943
{

jstest/testrunner/devices/device_base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import json
1616
import time
1717

18-
from jstest.common import console
18+
from jstest.common import console, utils
1919
from jstest.testrunner import utils as testrunner_utils
2020

2121
class RemoteDevice(object):
@@ -62,6 +62,9 @@ def iotjs_build_info(self):
6262
'''
6363
Get buildinfo from iotjs.
6464
'''
65+
if not utils.exist_files(self.env.modules.app.paths.tests, ['testsets.json']):
66+
return set(), set(), 'stable'
67+
6568
if self.device in ['rpi2', 'artik530']:
6669
iotjs = '%s/iotjs' % self.workdir
6770
buildinfo = '%s/tests/tools/iotjs_build_info.js' % self.workdir

jstest/testrunner/testrunner.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ def read_testsets(env):
2222
'''
2323
Read all the tests into dictionary.
2424
'''
25-
application = env.modules.app
25+
testset = utils.join(env.modules.app.paths.tests, 'testsets.json')
2626

27-
# Since JerryScript doesn't have testset descriptor file,
28-
# simply read the file contents from the test folder.
29-
if application['name'] == 'jerryscript':
30-
testsets = testrunner_utils.read_test_files(env)
31-
else:
32-
testsets = utils.read_json_file(application.paths['testfiles'])
27+
if utils.exists(testset):
28+
return utils.read_json_file(testset)
3329

34-
return testsets
30+
return testrunner_utils.read_test_files(env)
3531

3632

3733
class TestRunner(object):

0 commit comments

Comments
 (0)