From patchwork Mon Dec 3 11:47:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 152689 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6710773ljp; Mon, 3 Dec 2018 03:48:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/XtEcv+NKdFFLoMb3ycBOT21uxhfgjktBCgtrujQZ5AmvjLV6pBnALPkjCaOyzwHSo5bT/z X-Received: by 2002:a63:f111:: with SMTP id f17mr12975748pgi.236.1543837686802; Mon, 03 Dec 2018 03:48:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543837686; cv=none; d=google.com; s=arc-20160816; b=lCnrOwzAUcA/RhN5n+yBg8C/9MTpS4X9wDd6JjlNok4PH2xbzF8FY3S2PLdmMoVEb8 IGblWoL8tN8iqfVhtqdyaugDvjYqOGVhWTBjsan2DHwKqQUEwfwGQB2MkxoWF0XHDtS4 ZoUIngsiiXronU0IsipnUw/shIwZSukasx75QeQKLkw02/2AM8g80JRpwIs/Fr4YWXIm JMuVsANygUMauSPtI9eWQIYxWmboe+9hH+3FUl85t5t+e/57BMwqkHogW6b1hndCt/pX 2dbXrYFjgWhUuUXBc6SPpXJWCMvdVdTZa+rpsyegoZ2BZVXrV9+e1G5jgaHl33nmvY2T B1VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=DeyoRlEGZ+W1c7cZTpQhvvjld5qapwdU3hpHiL/8uQo=; b=uJWJTpvAJBDQrr/CGP9sbDOoQzA9aSLm3tYY6SOiFzcKDbZswxvoei0gamN5zgGr41 WN3UIO7SV2y26O49d7RqKYFQC1+cmLq6JpNOLL+sxghiU+phbAK5/j/UuCqw7e540OFw BvklY8nx+q+AKtlVuEsOElA/Z8zeTfrlj6/o5XN9LrKdILBT4C4+zTrNM8vLhcyC1Sp9 l16mqU9cxKTiAMtTrE2x6xbU3Fs29nYuQmqjz/WtegOL6l3FYe+5IVoy6tPvQjq/SZxG A1PPQbwNtdGRqhqGMwQ9Qmlzr57rKaYEBQtE+owtn5iPNjnLJxPSu3xxWdLbuEHYTsCH boNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=GHFhSNAX; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id c6si13561383plr.414.2018.12.03.03.48.06; Mon, 03 Dec 2018 03:48:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=GHFhSNAX; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from 165.28.230.35.bc.googleusercontent.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id C51896BE0C; Mon, 3 Dec 2018 11:48:01 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mail.openembedded.org (Postfix) with ESMTP id 8E1C56BE0C for ; Mon, 3 Dec 2018 11:48:00 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id a18so5359730wmj.1 for ; Mon, 03 Dec 2018 03:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=DNBzH6z8CPAwYAKJF00Ean2aEC1conxgibmzjZiiiLg=; b=GHFhSNAXPZwdcHKLRN/mJ3tmZ/uNo+zHgZ1PeDL9pjD/sqWh/Ak/vDPKIT4UbpsgaH LcMIHCAJyQmxlZIffb5hxpkm3QMqBwoiy3QKgm819Btr+3OZj1wwl7JNzxQxvX87RmvP cmxBFH8ueIj2qh3gstmSxrWdP7NdoDZ/9sjy5BT20rQWquARSatWrBnWk3fVA8yl/VAR kU7Vn3SfbodItgmOI/u9SXZSHRfyeTVuLo4QHEev68w79WGo6tA3APrhRPXmOSHBdTQI cxXecrcmQZyeRvYZVuFXTOS1pB4h2HiYOsv0bbai/y0isU/ZaleMBCBQ53rZM1A5cD5q +uKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=DNBzH6z8CPAwYAKJF00Ean2aEC1conxgibmzjZiiiLg=; b=HoNl7kaPyVrqhT0Wo1FTdFPFWRC0nsUczWmAyOzKINaIYVRlsqXDxNeJO1IfFk+Ed+ mH+irLX9iAKAweWOI9mTv8vtoYbiwnPZyeoaPlnY8vxYuZIHOD3QfpOnsCOeqo8EoQAe cjYd+3P3l7QsCXyjYwi3RVe4q0dayVJr9NPkURytQ7kRxodkHyoNq/wf4rduYoOokyYr QX5nRzkpOpLHZ0TQo6zGx09GUq+sPcFu05GRARe1ecQRA4d/pHL4wvsx5h7ehgt4oauX a0apWJC3UdySC1bmABEW0JXSTNxAS/kf3znH3yDKzwQ3yJYN0PHRroXTdJoi2OCEORtx FV6g== X-Gm-Message-State: AA+aEWa6J4i0X7Tgb68558n00vJOQuEJ7lLcyJ+Z7cWqqN4+i/IfMPLj sNv828N2wIlByNn6ifUr0Doq7vjt5Zw= X-Received: by 2002:a1c:c303:: with SMTP id t3mr7552790wmf.94.1543837680902; Mon, 03 Dec 2018 03:48:00 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id t4sm14785842wrm.6.2018.12.03.03.47.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 03:48:00 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Mon, 3 Dec 2018 11:47:58 +0000 Message-Id: <20181203114758.11474-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH] oeqa/oelib/path: don't leak temporary directories X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org setUp() is used to populate a directory of temporary files, and deleted in __del__. However setUp() is called once *per test* so __del__ would only be able to remove the last directory created. Fix the code by using the natural counterpart to setUp, tearDown(), to clean up. Signed-off-by: Ross Burton --- meta/lib/oeqa/selftest/cases/oelib/path.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/lib/oeqa/selftest/cases/oelib/path.py b/meta/lib/oeqa/selftest/cases/oelib/path.py index 75a27c06f77..e0eb8134a90 100644 --- a/meta/lib/oeqa/selftest/cases/oelib/path.py +++ b/meta/lib/oeqa/selftest/cases/oelib/path.py @@ -38,13 +38,6 @@ class TestRealPath(TestCase): ( "b/test", errno.ENOENT ), ] - def __del__(self): - try: - #os.system("tree -F %s" % self.tmpdir) - shutil.rmtree(self.tmpdir) - except: - pass - def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix = "oe-test_path") self.root = os.path.join(self.tmpdir, "R") @@ -59,6 +52,9 @@ class TestRealPath(TestCase): for l in self.LINKS: os.symlink(l[1], os.path.join(self.root, l[0])) + def tearDown(self): + shutil.rmtree(self.tmpdir) + def __realpath(self, file, use_physdir, assume_dir = True): return oe.path.realpath(os.path.join(self.root, file), self.root, use_physdir, assume_dir = assume_dir)