From patchwork Thu Apr 7 12:11:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 607383 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3qghK34K4Zz9t3V for ; Thu, 7 Apr 2016 22:11:32 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 3131C1D000; Thu, 7 Apr 2016 12:11:29 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail.sysmocom.de (mail.sysmocom.de [IPv6:2a01:4f8:191:444c::2:4]) by lists.osmocom.org (Postfix) with ESMTP id AD53C1CFF1 for ; Thu, 7 Apr 2016 12:11:27 +0000 (UTC) Received: from mail.sysmocom.de (mail.sysmocom.de [144.76.43.93]) by mail.sysmocom.de (Postfix) with ESMTP id 0B6FF1A20B3; Thu, 7 Apr 2016 12:11:27 +0000 (UTC) Received: from pbell.local (ip5b418565.dynamic.kabel-deutschland.de [91.65.133.101]) by mail.sysmocom.de (Postfix) with ESMTPSA id C0CC71A20B2; Thu, 7 Apr 2016 12:11:26 +0000 (UTC) From: msuraev@sysmocom.de To: openbsc@lists.osmocom.org Subject: [PATCH] Recursively copy files before config test Date: Thu, 7 Apr 2016 14:11:25 +0200 Message-Id: <1460031085-30498-1-git-send-email-msuraev@sysmocom.de> X-Mailer: git-send-email 2.8.1 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max Copy all potentially necessary files (like includable configs) before running config test. --- osmopy/osmotestconfig.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py index b020d86..5c981d1 100644 --- a/osmopy/osmotestconfig.py +++ b/osmopy/osmotestconfig.py @@ -17,7 +17,7 @@ import os import os.path import time -import sys +import sys, shutil import tempfile import osmopy.obscvty as obscvty @@ -72,15 +72,15 @@ def test_config_atest(app_desc, config, run_test, verbose=True): return ret - def copy_config(dirname, config): + shutil.rmtree(dirname, True) + ign = shutil.ignore_patterns('*.cfg') + shutil.copytree(os.path.dirname(config), dirname, ignore=ign) + try: os.stat(dirname) except OSError: os.mkdir(dirname) - else: - remove_tmpdir(dirname) - os.mkdir(dirname) prefix = os.path.basename(config) tmpfile = tempfile.NamedTemporaryFile(