mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
Revert "nixos-test-driver: use info/error/debug log feature more"
This reverts commit a2ff6e406e.
Pushed by accident to staging-nixos: https://matrix.to/#/%21UNVBThoJtlIiVwiDjU%3Anixos.org/%24UUtlLXPAwZaoeDXDT0wHC1PRZIWVhRNNgyvkKTVRG24?via=nixos.org&via=matrix.org&via=tchncs.de
This commit is contained in:
@@ -346,7 +346,7 @@ class Driver:
|
||||
vlan_symbols = {
|
||||
f"vlan{v.nr}": self.vlans[idx] for idx, v in enumerate(self.vlans)
|
||||
}
|
||||
self.logger.debug(
|
||||
print(
|
||||
"additionally exposed symbols:\n "
|
||||
+ ", ".join(map(lambda m: m.name, self.machines))
|
||||
+ ",\n "
|
||||
|
||||
@@ -248,7 +248,7 @@ class TerminalLogger(AbstractLogger):
|
||||
tic = time.time()
|
||||
yield
|
||||
toc = time.time()
|
||||
self.info(f"(finished: {message}, in {toc - tic:.2f} seconds)", attributes)
|
||||
self.log(f"(finished: {message}, in {toc - tic:.2f} seconds)", attributes)
|
||||
|
||||
def debug(self, *args, **kwargs) -> None:
|
||||
if self._log_level <= LogLevel.DEBUG:
|
||||
@@ -379,6 +379,6 @@ class XMLLogger(AbstractLogger):
|
||||
yield
|
||||
self.drain_log_queue()
|
||||
toc = time.time()
|
||||
self.info(f"(finished: {message}, in {toc - tic:.2f} seconds)")
|
||||
self.log(f"(finished: {message}, in {toc - tic:.2f} seconds)")
|
||||
|
||||
self.xml.endElement("nest")
|
||||
|
||||
@@ -271,18 +271,6 @@ class BaseMachine(ABC):
|
||||
"""
|
||||
self.logger.log(msg, {"machine": self.name})
|
||||
|
||||
def debug(self, msg: str) -> None:
|
||||
"""
|
||||
Log a message to console with log level for debug.
|
||||
"""
|
||||
self.logger.debug(msg, {"machine": self.name})
|
||||
|
||||
def error(self, msg: str) -> None:
|
||||
"""
|
||||
Log a message to console with log level for error.
|
||||
"""
|
||||
self.logger.error(msg, {"machine": self.name})
|
||||
|
||||
def log_serial(self, msg: str) -> None:
|
||||
self.logger.log_serial(msg, self.name)
|
||||
|
||||
@@ -867,7 +855,7 @@ class QemuMachine(BaseMachine):
|
||||
def tty_matches(last_try: bool) -> bool:
|
||||
text = self.get_tty_text(tty)
|
||||
if last_try:
|
||||
self.debug(
|
||||
self.log(
|
||||
f"Last chance to match /{regexp}/ on TTY{tty}, "
|
||||
f"which currently contains: {text}"
|
||||
)
|
||||
@@ -1073,8 +1061,8 @@ class QemuMachine(BaseMachine):
|
||||
|
||||
toc = time.time()
|
||||
|
||||
self.debug("connected to guest root shell")
|
||||
self.debug(f"(connecting took {toc - tic:.2f} seconds)")
|
||||
self.log("connected to guest root shell")
|
||||
self.log(f"(connecting took {toc - tic:.2f} seconds)")
|
||||
self.connected = True
|
||||
|
||||
@contextmanager
|
||||
@@ -1237,7 +1225,7 @@ class QemuMachine(BaseMachine):
|
||||
if self.booted:
|
||||
return
|
||||
|
||||
self.debug("starting vm")
|
||||
self.log("starting vm")
|
||||
|
||||
def clear(path: Path) -> Path:
|
||||
if path.exists():
|
||||
@@ -1311,7 +1299,7 @@ class QemuMachine(BaseMachine):
|
||||
self.pid = self.process.pid
|
||||
self.booted = True
|
||||
|
||||
self.debug(f"QEMU running (pid {self.pid})")
|
||||
self.log(f"QEMU running (pid {self.pid})")
|
||||
|
||||
def shutdown(self) -> None:
|
||||
"""
|
||||
@@ -1414,7 +1402,7 @@ class QemuMachine(BaseMachine):
|
||||
def release(self) -> None:
|
||||
if self.pid is None:
|
||||
return
|
||||
self.logger.debug(f"kill QemuMachine (pid {self.pid})")
|
||||
self.logger.info(f"kill QemuMachine (pid {self.pid})")
|
||||
assert self.process
|
||||
assert self.shell
|
||||
assert self.monitor
|
||||
@@ -1504,7 +1492,7 @@ class NspawnMachine(BaseMachine):
|
||||
if self.machine_sock:
|
||||
self.machine_sock.close()
|
||||
|
||||
self.logger.debug(f"kill NspawnMachine (pid {self.pid})")
|
||||
self.logger.info(f"kill NspawnMachine (pid {self.pid})")
|
||||
assert self.process is not None
|
||||
self.process.terminate()
|
||||
self.process = None
|
||||
@@ -1622,7 +1610,7 @@ class NspawnMachine(BaseMachine):
|
||||
proc = self.process
|
||||
|
||||
# 1. Wait for the directory to actually be created by the container
|
||||
self.debug(f"Waiting for journal at {journal_path}...")
|
||||
self.log(f"Waiting for journal at {journal_path}...")
|
||||
max_attempts = 10
|
||||
attempts = 0
|
||||
while not journal_path.exists() and attempts < max_attempts:
|
||||
@@ -1659,7 +1647,7 @@ class NspawnMachine(BaseMachine):
|
||||
if proc.poll() is not None:
|
||||
break
|
||||
except Exception as e:
|
||||
self.error(f"Error while reading journalctl output: {e}")
|
||||
self.log(f"Error while reading journalctl output: {e}")
|
||||
finally:
|
||||
log_proc.terminate()
|
||||
log_proc.wait()
|
||||
@@ -1697,7 +1685,7 @@ class NspawnMachine(BaseMachine):
|
||||
|
||||
self.pid = self.process.pid
|
||||
|
||||
self.debug(f"systemd-nspawn running (pid {self.pid})")
|
||||
self.log(f"systemd-nspawn running (pid {self.pid})")
|
||||
|
||||
journal_thread = threading.Thread(target=self._stream_journal, daemon=True)
|
||||
journal_thread.start()
|
||||
|
||||
Reference in New Issue
Block a user