From patchwork Sun Nov 4 04:12:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Martincoski X-Patchwork-Id: 992697 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ea5S4ipg"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42nj8X2KmszB4jy for ; Sun, 4 Nov 2018 15:13:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 192958613E; Sun, 4 Nov 2018 04:12:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B7uigpwQrYKN; Sun, 4 Nov 2018 04:12:55 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 370EB861A1; Sun, 4 Nov 2018 04:12:55 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 142491BF589 for ; Sun, 4 Nov 2018 04:12:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 122FD22D0D for ; Sun, 4 Nov 2018 04:12:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6i80GpAAGzrP for ; Sun, 4 Nov 2018 04:12:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by silver.osuosl.org (Postfix) with ESMTPS id 7B36E22798 for ; Sun, 4 Nov 2018 04:12:53 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id d135so9484095qkc.12 for ; Sat, 03 Nov 2018 21:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=j3SAg/jArFrjS8LV00IxK9LiaugtR/6fEMy9320xRCo=; b=ea5S4ipgLKNIchhhflS3rugoruQiO8iBkMqAs0w9moBAZrxlnlQE+yMmKvRygC6fBR dmThd4LxVp0R5zst8+mJrEeoASI/XZBil7kMNUISEeTFg4gxXIk17Wo71uNqTAV+msPZ es44XfqXMoDhWIKVlSObuXkL2sYJCmaKLaoEx59YYljj5pUHlp88cdCIgm9CvOdX04kK rU/ppWMIdSDQ4FQxNBnob9LmEVC02EBjhLI9H0xkse15sbkcAqBUSHdoFzri0r4WzdmB lyWug8UpLlCXbDlfamownOzmVCQixN+LR0TH5b2xWX2cBMClWGQc83gDUxWF1l6Vmj16 v19g== 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:in-reply-to :references:in-reply-to:references; bh=j3SAg/jArFrjS8LV00IxK9LiaugtR/6fEMy9320xRCo=; b=CO/50v30qDankBzwE64iUUbt42QSEQjTr/1HM2VQAhlIjM/CqZGpNfChL6MuNw3mdo Nw+7sDgDaZjrYBwHHNFbrypuwmyC9tOaDewyJkrdVZ65ooqE3uaord+JUaGcsS6bVPCc dY0qztfjd7+9U14kWA4KtNTSerGRhnMX5bnXdkRlbcPXQQUY6amTZRday62DnAkTOPJB qZdQPZdsKWG+f27Xw86y4Dz7nR5BtHAhf9dRU4K4qd12nz9GK1W5JCyWY5TBR+JRZU2D d3ZSMI3TrpgisLg5qeh8G0qFBKLysPDy73+ySeMbrXe/00FFhrjRTHYtNUEAjp6fW78U hvyg== X-Gm-Message-State: AGRZ1gImzAwIch2qR/PD+BM6wXQR+G+Gzvk7o8blkcI/Zb0Yy0ly1ufb TR0I5ny+RR+6Or+Lo9h5OIcEPJYw X-Google-Smtp-Source: AJdET5e8/zAp0lvkkDMarf6M/7wkcJMR+aBq3gg/bMN8p65AUCOqgwEvthlXuIKxX/SQEJCFkoeVTQ== X-Received: by 2002:a37:1fc6:: with SMTP id n67mr16349312qkh.180.1541304772429; Sat, 03 Nov 2018 21:12:52 -0700 (PDT) Received: from ultri5.home ([177.18.158.192]) by smtp.gmail.com with ESMTPSA id 35-v6sm25625076qtr.91.2018.11.03.21.12.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Nov 2018 21:12:52 -0700 (PDT) From: Ricardo Martincoski To: buildroot@buildroot.org Date: Sun, 4 Nov 2018 02:12:06 -0200 Message-Id: <20181104041209.23028-3-ricardo.martincoski@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181104041209.23028-1-ricardo.martincoski@gmail.com> References: <20181104041209.23028-1-ricardo.martincoski@gmail.com> In-Reply-To: <20181103045624.31059-1-ricardo.martincoski@gmail.com> References: <20181103045624.31059-1-ricardo.martincoski@gmail.com> Subject: [Buildroot] [PATCH v2 2/5] support/testing: allow run-tests to be called from anywhere X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Ricardo Martincoski , "Yann E . MORIN" MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Currently run-tests must be called from the Buildroot top directory. Derive the top directory from the script path, so run-tests can be called from any path. As a consequence the test infra will always test the repo it belongs to. Suggested-by: Yann E. MORIN Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Cc: Thomas Petazzoni Cc: Yann E. MORIN --- The suggestion happened one year ago, but I just remembered it now that I need the base dir to be used by a test case. Search for "derive the top" in http://patchwork.ozlabs.org/patch/814544/ Changes v1 -> v2: - no changes --- support/testing/infra/__init__.py | 8 +++++++- support/testing/infra/builder.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/support/testing/infra/__init__.py b/support/testing/infra/__init__.py index e229e90852..1d4d18bbe9 100644 --- a/support/testing/infra/__init__.py +++ b/support/testing/infra/__init__.py @@ -6,6 +6,7 @@ import subprocess from urllib2 import urlopen, HTTPError, URLError ARTIFACTS_URL = "http://autobuild.buildroot.net/artefacts/" +BASE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), "../../..")) def open_log_file(builddir, stage, logtofile=True): @@ -21,8 +22,13 @@ def open_log_file(builddir, stage, logtofile=True): return fhandle +def basepath(relpath=""): + """Return the absolute path for a file or directory relative to the Buildroot top directory.""" + return os.path.join(BASE_DIR, relpath) + + def filepath(relpath): - return os.path.join(os.getcwd(), "support/testing", relpath) + return os.path.join(BASE_DIR, "support/testing", relpath) def download(dldir, filename): diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py index fc318fe26e..26fa6be7ae 100644 --- a/support/testing/infra/builder.py +++ b/support/testing/infra/builder.py @@ -29,7 +29,7 @@ class Builder(object): "O={}".format(self.builddir), "olddefconfig"] ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile, - env=env) + cwd=infra.basepath(), env=env) if ret != 0: raise SystemError("Cannot olddefconfig")