Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
IPDSnelting
mjtest
Commits
11722f1f
Commit
11722f1f
authored
Oct 29, 2016
by
Johannes Bechberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing required package to setup.py
parent
70163d26
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
13 deletions
+19
-13
README.mdwn
README.mdwn
+5
-4
mjtest/cli.py
mjtest/cli.py
+10
-5
mjtest/environment.py
mjtest/environment.py
+2
-3
setup.py
setup.py
+2
-1
No files found.
README.mdwn
View file @
11722f1f
...
@@ -63,15 +63,16 @@ Output of the `mjtest --help`
...
@@ -63,15 +63,16 @@ Output of the `mjtest --help`
```
```
usage: mjtest [-h] [--tmp_dir] [--test_dir] [--only_incorrect_tests]
usage: mjtest [-h] [--tmp_dir] [--test_dir] [--only_incorrect_tests]
[--parallel] [--timeout] [--report_dir] [--log LOG]
[--parallel] [--timeout] [--report_dir] [--log LOG]
{syntax,semantic,exec} MJ_RUN
_CMD
{syntax,semantic,exec} MJ_RUN
MiniJava test runner
MiniJava test runner
positional arguments:
positional arguments:
{syntax,semantic,exec}
{syntax,semantic,exec}
What do you want to test?
What do you want to test?
MJ_RUN_CMD Command to run your MiniJava implementation, e.g.
MJ_RUN Command to run your MiniJava implementation, e.g.
`mj/run`
`mj/run`, can be omitted by assigning the environment
variable MJ_RUN
optional arguments:
optional arguments:
-h, --help show this help message and exit
-h, --help show this help message and exit
...
@@ -90,7 +91,7 @@ optional arguments:
...
@@ -90,7 +91,7 @@ optional arguments:
### Example usage
### Example usage
Assuming you want to run the syntax tests and your MiniJava base folder is `~/code/mj` then run
Assuming you want to run the syntax tests and your MiniJava base folder is `~/code/mj` then run
```
```
mjtest syntax ~/code/mj/run --lextest
MJ_RUN="~/code/mj/run" mjtest syntax
```
```
This will…
This will…
- … create reports in a folder named after the current date and time inside the `reports` folder
- … create reports in a folder named after the current date and time inside the `reports` folder
...
...
mjtest/cli.py
View file @
11722f1f
import
logging
import
logging
import
os
from
pprint
import
pprint
from
pprint
import
pprint
import
sys
import
sys
import
mjtest.util.utils
import
mjtest.util.utils
...
@@ -26,9 +27,11 @@ if True:#__name__ == '__main__':
...
@@ -26,9 +27,11 @@ if True:#__name__ == '__main__':
parser
.
add_argument
(
"mode"
,
parser
.
add_argument
(
"mode"
,
choices
=
TEST_MODES
,
choices
=
TEST_MODES
,
help
=
"What do you want to test?"
)
help
=
"What do you want to test?"
)
parser
.
add_argument
(
"mj_run_cmd"
,
if
os
.
getenv
(
"MJ_RUN"
,
None
)
is
None
:
metavar
=
"MJ_RUN_CMD"
,
parser
.
add_argument
(
"mj_run"
,
help
=
"Command to run your MiniJava implementation, e.g. `mj/run`"
)
metavar
=
"MJ_RUN"
,
help
=
"Command to run your MiniJava implementation, e.g. `mj/run`, "
"can be omitted by assigning the environment variable MJ_RUN"
)
parser
.
add_argument
(
"--tmp_dir"
,
action
=
"store_const"
,
default
=
""
,
const
=
"tmp_dir"
,
parser
.
add_argument
(
"--tmp_dir"
,
action
=
"store_const"
,
default
=
""
,
const
=
"tmp_dir"
,
help
=
"Used temporary directory"
)
help
=
"Used temporary directory"
)
parser
.
add_argument
(
"--test_dir"
,
action
=
"store_const"
,
default
=
""
,
const
=
"test_dir"
,
parser
.
add_argument
(
"--test_dir"
,
action
=
"store_const"
,
default
=
""
,
const
=
"test_dir"
,
...
@@ -43,8 +46,10 @@ if True:#__name__ == '__main__':
...
@@ -43,8 +46,10 @@ if True:#__name__ == '__main__':
help
=
"Directory to store the reports in, default is 'reports'"
)
help
=
"Directory to store the reports in, default is 'reports'"
)
parser
.
add_argument
(
"--log_level"
,
action
=
LogLevelChoices
,
default
=
"warn"
,
const
=
"log_level"
,
parser
.
add_argument
(
"--log_level"
,
action
=
LogLevelChoices
,
default
=
"warn"
,
const
=
"log_level"
,
help
=
"Logging level (error, warn, info or debug)"
)
help
=
"Logging level (error, warn, info or debug)"
)
args
=
parser
.
parse_args
()
args
=
vars
(
parser
.
parse_args
())
suite
=
TestSuite
(
Environment
(
**
vars
(
args
)))
if
os
.
getenv
(
"MJ_RUN"
,
None
)
is
not
None
:
args
[
"mj_run"
]
=
os
.
getenv
(
"MJ_RUN"
)
suite
=
TestSuite
(
Environment
(
**
args
))
ret
=
None
ret
=
None
try
:
try
:
ret
=
suite
.
run
()
ret
=
suite
.
run
()
...
...
mjtest/environment.py
View file @
11722f1f
...
@@ -5,7 +5,6 @@ import tempfile
...
@@ -5,7 +5,6 @@ import tempfile
from
datetime
import
datetime
,
time
from
datetime
import
datetime
,
time
from
mjtest.util.shell
import
execute
from
mjtest.util.shell
import
execute
from
mjtest.util.utils
import
get_mjtest_basedir
from
mjtest.util.utils
import
get_mjtest_basedir
import
humanfriendly
as
hf
from
typing
import
Tuple
,
List
from
typing
import
Tuple
,
List
...
@@ -28,11 +27,11 @@ class Environment:
...
@@ -28,11 +27,11 @@ class Environment:
"debug"
:
logging
.
DEBUG
"debug"
:
logging
.
DEBUG
}
}
def
__init__
(
self
,
mode
,
mj_run
_cmd
:
str
,
tmp_dir
:
str
=
""
,
test_dir
:
str
=
""
,
def
__init__
(
self
,
mode
,
mj_run
:
str
,
tmp_dir
:
str
=
""
,
test_dir
:
str
=
""
,
only_incorrect_tests
:
bool
=
False
,
parallel
:
bool
=
False
,
only_incorrect_tests
:
bool
=
False
,
parallel
:
bool
=
False
,
timeout
:
int
=
30
,
report_dir
:
str
=
""
,
log_level
:
str
=
"warn"
):
timeout
:
int
=
30
,
report_dir
:
str
=
""
,
log_level
:
str
=
"warn"
):
self
.
mode
=
mode
self
.
mode
=
mode
self
.
mj_run_cmd
=
os
.
path
.
realpath
(
mj_run
_cmd
)
self
.
mj_run_cmd
=
os
.
path
.
realpath
(
mj_run
)
if
tmp_dir
:
if
tmp_dir
:
self
.
own_tmp_dir
=
True
self
.
own_tmp_dir
=
True
...
...
setup.py
View file @
11722f1f
...
@@ -27,6 +27,7 @@ setup(name='mjtest',
...
@@ -27,6 +27,7 @@ setup(name='mjtest',
'''
,
'''
,
install_requires
=
[
install_requires
=
[
'click'
,
'click'
,
'humanfriendly'
,
'termcolor'
'termcolor'
,
'rainbow_logging_handler'
]
]
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment