From patchwork Mon Jun 7 10:10:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 1488556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fz9ln42hRz9sWX; Mon, 7 Jun 2021 21:15:49 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lqDEO-0000bC-4R; Mon, 07 Jun 2021 11:15:44 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lqCDb-0006Vh-Mn for kernel-team@lists.ubuntu.com; Mon, 07 Jun 2021 10:10:51 +0000 Received: from mail-wm1-f69.google.com ([209.85.128.69]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lqCDb-0004nD-Fr for kernel-team@lists.ubuntu.com; Mon, 07 Jun 2021 10:10:51 +0000 Received: by mail-wm1-f69.google.com with SMTP id a19-20020a1c98130000b02901960b3b5621so2208777wme.8 for ; Mon, 07 Jun 2021 03:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qKwJ9sLuROi7qHivPviaH8pSktNY//PWm4fE6C3OHVk=; b=h2wzy904sUGekRjgDugmy4VjNMJynSmvhane1yxfLZEqOHBeYQPt1OnGlBxDMHcebk jr5VHdgRxCW/OBdfdLSu5qY0/h2RcCocCRaBA9HbtmHoPn04d5+E1L0kPhyRQ5LJ7PME EfVbqLQQz6zyq4l8TLG+eZtrTMG2mcoMrQgW2u+oeltyOAwaW8jagaAdTz1ysYAJ+Vbh qZmaEVD6BvOJ8PTV5IQiiS67HpeiqCAl7Oxgj1XUpL+J65CNiKpm5ygcKLT4IZ6REr7c dY39zOykG5eEOI2ty54xCuK0PNkCLYOA/uPplIT6WrBrPXnUjNvEH3WKeVUEt5fSvp2g pyMg== X-Gm-Message-State: AOAM531O48Tj9OrV/PUyT3hqHeItY5B7PKn+PfXUg/9ls9U/wTH2t3L7 GdXrvadnxR5jiab0iCXl3IPPC8ajAbDQtcFvxs5tgKC5NR9W9UPGzKq7mV2vPjKM//Ib7FEzWDw 2n/LCD3nCkFjhhdH1k2O0+LJk3INX+st6Uy5hvb72Xg== X-Received: by 2002:a5d:47a3:: with SMTP id 3mr16338533wrb.42.1623060650805; Mon, 07 Jun 2021 03:10:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxySA+vP332SdFXjordKQ5DHjprx6F5nG6fv4ppPnnrdE+HY5+OOm21l6TT6NrEmmflb791tg== X-Received: by 2002:a5d:47a3:: with SMTP id 3mr16338514wrb.42.1623060650577; Mon, 07 Jun 2021 03:10:50 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-185-9.adslplus.ch. [188.155.185.9]) by smtp.gmail.com with ESMTPSA id l5sm16756927wmi.46.2021.06.07.03.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 03:10:50 -0700 (PDT) From: Krzysztof Kozlowski To: kernel-team@lists.ubuntu.com Subject: [ACT][PATCH v3] UBUNTU: SAUCE: ubuntu_boot: fix second test execution Date: Mon, 7 Jun 2021 12:10:32 +0200 Message-Id: <20210607101032.32038-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" The setup() might not be called on second test run and actually autotest design assumes setup() for given version will be called exactly once. It is expected from setup() to modify only persistent state of the system, so on next run it's execution is not needed. Runtime-only settings should not be configured via setup(). This fixes failure on second test execution: 00:54:03 INFO | START ubuntu_boot.log_check ubuntu_boot.log_check 00:54:03 DEBUG| Persistent state client._record_indent now set to 2 00:54:03 DEBUG| Persistent state client.unexpected_reboot now set to ('ubuntu_boot.log_check', 'ubuntu_boot.log_check') 00:54:03 DEBUG| Waiting for pid 19403 for 300 seconds 00:54:03 WARNI| System python is too old, crash handling disabled 00:54:03 ERROR| Exception escaping from test: Traceback (most recent call last): File "/home/azure/autotest/client/shared/test.py", line 411, in _exec _call_test_function(self.execute, *p_args, **p_dargs) File "/home/azure/autotest/client/shared/test.py", line 830, in _call_test_function raise error.UnhandledTestFail(e) UnhandledTestFail: Unhandled AttributeError: 'ubuntu_boot' object has no attribute 'centos' Traceback (most recent call last): File "/home/azure/autotest/client/shared/test.py", line 823, in _call_test_function return func(*args, **dargs) File "/home/azure/autotest/client/shared/test.py", line 291, in execute postprocess_profiled_run, args, dargs) File "/home/azure/autotest/client/shared/test.py", line 212, in _call_run_once self.run_once(*args, **dargs) File "/home/azure/autotest/client/tests/ubuntu_boot/ubuntu_boot.py", line 63, in run_once if not self.log_check(): File "/home/azure/autotest/client/tests/ubuntu_boot/ubuntu_boot.py", line 25, in log_check if self.centos: AttributeError: 'ubuntu_boot' object has no attribute 'centos' Fixes: e14cb0e1bd0c ("UBUNTU SAUCE: ubuntu_boot Centos Support") Signed-off-by: Krzysztof Kozlowski Acked-by: Po-Hsu Lin --- Changes since v2: 1. Simplify the code and remove 'centos' variable. Changes since v1: 1. Add prefix to subject --- ubuntu_boot/ubuntu_boot.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ubuntu_boot/ubuntu_boot.py b/ubuntu_boot/ubuntu_boot.py index a67f21d49fc7..8782818fdf01 100644 --- a/ubuntu_boot/ubuntu_boot.py +++ b/ubuntu_boot/ubuntu_boot.py @@ -12,17 +12,14 @@ class ubuntu_boot(test.test): cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs) self.results = utils.system_output(cmd, retain_output=True) + def log_check(self): + '''Test for checking error patterns in log files''' '''Centos Specific Boot Test Checks''' - self.centos = False os_dist = platform.linux_distribution()[0].split(' ')[0] - if os_dist == 'CentOS': - self.centos = True - def log_check(self): - '''Test for checking error patterns in log files''' # dmesg will be cleared out in autotest with dmesg -c before the test starts # Let's check for /var/log/syslog instead - if self.centos: + if os_dist == 'CentOS': logfile = '/var/log/messages' else: logfile = '/var/log/syslog'