def test_check_dmesg_filter0001(self, platform, mock_manifest): old_lines = ["START"] # anchor so krun knows where the changes start new_lines = [ "START", # all junk to ignore, and that we have seen in the wild "[ 76.486320] e1000e: eth0 NIC Link is Down", "[ 115.052369] e1000e 0000:00:19.0: irq 43 for MSI/MSI-X", "[ 115.153954] e1000e 0000:00:19.0: irq 43 for MSI/MSI-X", # twice "[ 115.154048] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready", "[ 118.714565] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None", "[ 118.714594] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready", "[ 6.672097] r8169 0000:06:00.0 eth0: link up", "[ 190.178748] r8169 0000:06:00.0 eth0: link down", "[ 190.178780] r8169 0000:06:00.0 eth0: link down", "[ 193.276415] r8169 0000:06:00.0 eth0: link up", # the graphics card going into powersave "[ 3.793646] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off", # Dell poweredge R330 network coming up "[ 75.007580] tg3 0000:04:00.0 eth0: Link is up at 1000 Mbps, full duplex", "[ 75.007582] tg3 0000:04:00.0 eth0: Flow control is off for TX and off for RX", "[ 75.007583] tg3 0000:04:00.0 eth0: EEE is disabled", ] assert not platform._check_dmesg_for_changes( platform.get_dmesg_whitelist(), old_lines, new_lines, mock_manifest)
def test_custom_dmesg_whitelist0002(monkeypatch): """Test a config file that replaces entirely the dmesg whitelist""" path = os.path.join(TEST_DIR, "custom_dmesg_whitelist0002.krun") config = Config(path) platform = krun.platform.detect_platform(None, config) patterns = [p.pattern for p in platform.get_dmesg_whitelist()] assert patterns == ["^.no+", "^defaults", "^here+"]
def test_custom_dmesg_whitelist0003(monkeypatch): """Test a config file that uses no custom whitelist""" path = os.path.join(TEST_DIR, "example.krun") config = Config(path) platform = krun.platform.detect_platform(None, config) patterns = [p.pattern for p in platform.get_dmesg_whitelist()] assert patterns == platform.default_dmesg_whitelist()
def test_custom_dmesg_whitelist0001(monkeypatch): """Test a config file that appends two patterns to the default whitelist""" path = os.path.join(TEST_DIR, "custom_dmesg_whitelist0001.krun") config = Config(path) platform = krun.platform.detect_platform(None, config) patterns = [p.pattern for p in platform.get_dmesg_whitelist()] assert patterns == platform.default_dmesg_whitelist() + \ ["^custom1*", "^.custom2$"]