about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2019-11-25 01:08:06 +0100
committerRobin Gloster <mail@glob.in>2019-11-25 01:08:06 +0100
commitba03a1b731172c975ea9214f8370290d51677e42 (patch)
treec5c8b5684b644126c871998ce35b72bb0d85efef /nixos/lib
parent9a2c7caa43f1cb83b3efd156de35aea85196f32f (diff)
downloadnixlib-ba03a1b731172c975ea9214f8370290d51677e42.tar
nixlib-ba03a1b731172c975ea9214f8370290d51677e42.tar.gz
nixlib-ba03a1b731172c975ea9214f8370290d51677e42.tar.bz2
nixlib-ba03a1b731172c975ea9214f8370290d51677e42.tar.lz
nixlib-ba03a1b731172c975ea9214f8370290d51677e42.tar.xz
nixlib-ba03a1b731172c975ea9214f8370290d51677e42.tar.zst
nixlib-ba03a1b731172c975ea9214f8370290d51677e42.zip
nixos/tests: fail on failing subtests
This was the behaviour in the perl test driver too and a regression.

Also cleaned up unused imports
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test-driver.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index 0b8e3b67c9b2..e45521424de3 100644
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -3,7 +3,6 @@ from contextlib import contextmanager, _GeneratorContextManager
 from xml.sax.saxutils import XMLGenerator
 import _thread
 import atexit
-import json
 import os
 import ptpython.repl
 import pty
@@ -16,7 +15,7 @@ import sys
 import tempfile
 import time
 import unicodedata
-from typing import Tuple, TextIO, Any, Callable, Dict, Iterator, Optional, List
+from typing import Tuple, Any, Callable, Dict, Iterator, Optional, List
 
 CHAR_TO_KEY = {
     "A": "shift-a",
@@ -771,7 +770,9 @@ def run_tests() -> None:
             machine.execute("sync")
 
     if nr_tests != 0:
-        log.log("{} out of {} tests succeeded".format(nr_succeeded, nr_tests))
+        eprint("{} out of {} tests succeeded".format(nr_succeeded, nr_tests))
+        if nr_tests > nr_succeeded:
+            sys.exit(1)
 
 
 @contextmanager