From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.2036.1612487961074484836 for ; Thu, 04 Feb 2021 17:19:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=hGUjKCFK; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: yuwei.chen@intel.com) IronPort-SDR: onmMXpUGRXXOtClS/sSJas0IMbH7XyA7HjCO0bj+gpnCOEzMBtjAAevt32mNHvRFcSt5dxOIxE lKd/UfzOlmiA== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="181425652" X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="181425652" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 17:19:04 -0800 IronPort-SDR: QDZPyyjlbhMTtYjyIlyvCFypiTDPGDj+WoC6iJ9bjr+vFfQuOhuFwra0NjohABDLMvhYthUwsx r2znmL+ZM/xA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="360180566" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga006.jf.intel.com with ESMTP; 04 Feb 2021 17:19:03 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 4 Feb 2021 17:19:04 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 4 Feb 2021 17:19:04 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.177) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Thu, 4 Feb 2021 17:19:01 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UExW75LeiKILI9I27WaWGZ5m0ZagcBA+fKReZLc6ATbJ3BoF8I+d9tgKT4ntWkGeU2GdvFgZ8nCbeCsK6SWjm4QHML2mFgtZ8lwpfOprJe8VjwWJDDSim1R+79hlY0tObzklxUlvnqPvy2wOdMZ9RvJQyM0cp/BOg+Aj+Xmha9LZGPQK+GZHzGyp5iw+KHIk2iun6XXfPvLW75ZvNoaYD5A8zeKgQeZYc7wMAqWczIIgG5aRTeV4+APv7lJ5NVVPrcb/HC4ZFT+azqc04iHV5V7uqMtDF7iG2bh4OZ8aFdAUwfQ/wVv0J29c4UZtEt/vlyga79/JyJTe3tLLHghzSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v1lqL1hVV9bZTrAF6fieW/TTXLOojMJQqDazeGF5F9s=; b=Q2GWxRrvepsmpN/TGLPfjRjqkgRgcGGU34ASHdGkwUFtLBs2JIh8PDZE2TbJzT8qv4Hw5+1qIpNk2ZzOmb4oV6Wy+sgAHRuJv8xEn0oj3XSbEw8ZsflZvDmBQFGDkmKvlZ5cjCHnzqTPsjl3tyhJiwu90xVWzd2R7GNRy0lIFWEmb6npUhXjJgIB22Y7LElU3aqgazXNOdyVMr5K4sfxHHiHj1ur0AyUKRD0bJ8rfuGphWEkGo7xrvBErqv0qbWHXlplyCn/xvxWsGvVHE9Kmw3f57BqWMnx0uX6QvF31WpEsKsmAwUr/3PscRFFlBN6R/fH7rh9+61/LBAFWOKHVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v1lqL1hVV9bZTrAF6fieW/TTXLOojMJQqDazeGF5F9s=; b=hGUjKCFKGtzwKUoVgJ9MRfTvuMBr5edD8sYr8XXOBVdCvBY45B3mn4Vow1ziFTjzWnOILCLYoXGUFJiaKnb8bqcJsfIOqT3Nh37Hd3Y917QejnWdWH7j8TMTzSLkuGALfLZOsYhdJjSX3zuwCjnfggj1pKrhgFc3iYFLVXx1vSw= Received: from DM5PR11MB1594.namprd11.prod.outlook.com (2603:10b6:4:5::16) by DM5PR1101MB2122.namprd11.prod.outlook.com (2603:10b6:4:54::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.24; Fri, 5 Feb 2021 01:18:59 +0000 Received: from DM5PR11MB1594.namprd11.prod.outlook.com ([fe80::59f7:5329:fc62:a3be]) by DM5PR11MB1594.namprd11.prod.outlook.com ([fe80::59f7:5329:fc62:a3be%9]) with mapi id 15.20.3805.026; Fri, 5 Feb 2021 01:18:59 +0000 From: "Yuwei Chen" To: "Feng, Bob C" , "devel@edk2.groups.io" CC: Liming Gao Subject: Re: [Patch 1/1 V2] BaseTools: fix the split output files root dir Thread-Topic: [Patch 1/1 V2] BaseTools: fix the split output files root dir Thread-Index: AQHW+IUVIfmdghGMsEiNb/WbVohFuqpIyKsA Date: Fri, 5 Feb 2021 01:18:58 +0000 Message-ID: References: <20210201102858.887-1-bob.c.feng@intel.com> In-Reply-To: <20210201102858.887-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b9dac573-f193-4864-72f0-08d8c97403d1 x-ms-traffictypediagnostic: DM5PR1101MB2122: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1122; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vKd1rHgydpHWSdoQgmFyLt76S4IBOREBTyvKx8TZB6WvtzjImaoCjY572jDjIRLixklQ2b9Shje5Gl/tAzdSt6OWFm83MeLBGO7mORoL4NNxMPkGCMpFIxyuzelB+X7+0YajdTrzcnEO9FRZtnzX12SvItiAlW28NKGFk1U1aVOZVyRiNzQ6OD+MLqn2lNwVd+8wjEK1Ofrexv1d59YeVf44udRsc1gFfwoDm679sOQjr5fEnJlmOcjXfaXZXBqXLcvATLQeRv2Q0nGg4jDzBbmsOhXfakC2lyWxE2wtp2PXOZ7U3NOXotopEIOmd0XXP1pIAfd4JiIUxR1nIURZOuCqkIz9fYwNYDLMCvalxzztKYx0l2tAHLH2xroJEddxE0k5SVYFHHeJMtKzRTRItnlBfJpF/wkjuK4BMYFmnqmPdcSVk22j8X8px9m3+NP1MFPnmasFepLYLrrU7HvzZ2fEMnKehG6N5zxY0UOttL5dPjHl4FtRsDIMq39VY3QBXLTBuxDDMnOpGfE4uMVsJw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR11MB1594.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(366004)(346002)(39860400002)(136003)(376002)(9686003)(83380400001)(76116006)(186003)(8936002)(66476007)(26005)(55016002)(5660300002)(66556008)(6506007)(8676002)(66946007)(4326008)(52536014)(53546011)(478600001)(71200400001)(86362001)(2906002)(110136005)(316002)(66446008)(7696005)(33656002)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?S0uLGf5/AZYrWmYEuurm87DyH6FuPc1gElckFL8Hdg5b2Hz/4HVaxj8smIkG?= =?us-ascii?Q?zsL0C87YhqMj+Ve1ZV7gzU6iIeCmk0i6Yf4ESPiMtfzXQExHUKsO6Ynb+Ci1?= =?us-ascii?Q?hgtuBma2rgrGufwgHIfSLML/aQ/kyw8fxc+OIoZJzPsYPw5mzKZL2jHeB7DH?= =?us-ascii?Q?ghvmszZu7DJrs0JILnnoE+/1VUPf/yCEvXPcfWWx17Rd/ZgNjYz7NJypRgH1?= =?us-ascii?Q?CgpwK6p+vxlNf/GKeLiW7vSr3HIbJX31icef33zQ9ftAXTkPmP/O8vV8xim+?= =?us-ascii?Q?Rglc+IbYnQtmzx4gcEKsplQj16k1jo56FOkRKhEC+CckG1aKjN+N0DrLfvBR?= =?us-ascii?Q?0UwLQhbFIPDZuhgtt2WDOtPVsBCRtH/rPK30l1l6EuscKE4gN/9xCWL745Nj?= =?us-ascii?Q?aqtIccHMuDWBfsuVNLj0LvfPeH4F3KVkIRZeERWOaiaHvDpOushA6LVbdp0u?= =?us-ascii?Q?yR1I4115aCiaxY/11t1VxQFRgwVIwFAaHGnaBPsEVr5+2QpYkQu+GsgLLb7i?= =?us-ascii?Q?CUiVwbd1HTbNX+2opp1jpEdgg/C22ibp0KQPCcHkaPR6uGH2IFx68PtHKPMy?= =?us-ascii?Q?9xD+T29T245rVAHkGYG/eSlS0YxA2y1oh/9Ep6irH7IQF89K5BNJ5cnEcp9h?= =?us-ascii?Q?iqXcDyOmQ7qbIpAIn11e46Ma9Mbi8QxIuIbTMa2pnHknhQp6IJN/E0RdWkTF?= =?us-ascii?Q?eUbC84V8wsk9ux2HINOSpVY1HtC/wwAKrLbC1DxK5UrPhu3q4xFbtimOUZ1e?= =?us-ascii?Q?LhXI/ZE2w9UdsGUB5cHghk7qeEmTp0Ivj+5Rhcej280+7bxriD4rVgSvm/sE?= =?us-ascii?Q?onmw8GtYSCL4xsPzixRx5OUcfo4MubqQ4lx2Pw3t7eWWGAY622qtRXmLz0Ag?= =?us-ascii?Q?a98NFPBgWj4IteY+hRTlvw5m2qWu3UxNu52Srh1w9w5jUuIoCJxxMyl2+qo1?= =?us-ascii?Q?Vp6goexquok3B9ynQWPGKvdNi0iJfmr1opgtTrjLsbIyPVpD0WurD45dslD5?= =?us-ascii?Q?TcOUNsGdzG5PTJZsM/wjzvCpYX+QsENjLX9qNhJEUtO8TnBBTUJ+pMuiqhk/?= =?us-ascii?Q?L6XZJzTEA1V5JjSspYCUVyFO71Z6AdF/Xyp/UL/nAAs3QAgRwJq02UE2TVBY?= =?us-ascii?Q?oUD7QFVM/3l9civ8c4GUg7CXMef9PDb7k7p1vB1yn24tIHXNnud1QASoa84M?= =?us-ascii?Q?7TYsG0din3a4jnRG/ZAAqd90KvM3rTkId5LWZa+QHvWGZ+LEDMX9tMi8M7qe?= =?us-ascii?Q?ww8Nf0N95KMU4C3nfTMgmv+58h2aake085Ol53iKb4vfQLJP+wEoTwpa4hKy?= =?us-ascii?Q?WY+j26K38E6WQyka4xhcFDtG?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1594.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9dac573-f193-4864-72f0-08d8c97403d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2021 01:18:58.9333 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: YkIGc0YbjWyM5/bTUIECBQw+Am2Y4G/0NnM1w5Q6al8eHwbW2UeVJb/aLPx4TRDtYe2HBfEsGrFP3LHdiBZ9Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1101MB2122 Return-Path: yuwei.chen@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yuwei Chen > -----Original Message----- > From: Feng, Bob C > Sent: Monday, February 1, 2021 6:29 PM > To: devel@edk2.groups.io > Cc: Liming Gao ; Chen, Christine > > Subject: [Patch 1/1 V2] BaseTools: fix the split output files root dir >=20 > If the output file path is a relative path, the split tool will create th= e output > file under the input file path. > But the expected behavior for this case is the output file should be rela= tive to > the current directory. This patch will fix this bug. >=20 > If the output file path is not specified and output prefix is not specifi= ed, the > output file should be under the input file path >=20 > Signed-off-by: Bob Feng > Cc: Liming Gao > Cc: Yuwei Chen > --- > V2: If the output file path is not specified and output prefix is not spe= cified, > the output file should be under the input file path > BaseTools/Source/Python/Split/Split.py | 64 +++++++------ > .../Source/Python/tests/Split/test_split.py | 96 ++++++++++--------- > 2 files changed, 86 insertions(+), 74 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Split/Split.py > b/BaseTools/Source/Python/Split/Split.py > index 45a5a060474c..e223a72a94e1 100644 > --- a/BaseTools/Source/Python/Split/Split.py > +++ b/BaseTools/Source/Python/Split/Split.py > @@ -90,66 +90,74 @@ def getFileSize(filename): > logger.error("Access file failed: %s", filename) > raise(e) >=20 > return length >=20 > +def getoutputfileabs(inputfile, prefix, outputfile,index): > + inputfile =3D os.path.abspath(inputfile) > + if outputfile is None: > + if prefix is None: > + outputfileabs =3D os.path.join(os.path.dirname(inputfile), > "{}{}".format(os.path.basename(inputfile),index)) > + else: > + if os.path.isabs(prefix): > + outputfileabs =3D os.path.join(prefix, > "{}{}".format(os.path.basename(inputfile),index)) > + else: > + outputfileabs =3D os.path.join(os.getcwd(), prefix, > "{}{}".format(os.path.basename(inputfile),index)) > + elif not os.path.isabs(outputfile): > + if prefix is None: > + outputfileabs =3D os.path.join(os.getcwd(), outputfile) > + else: > + if os.path.isabs(prefix): > + outputfileabs =3D os.path.join(prefix, outputfile) > + else: > + outputfileabs =3D os.path.join(os.getcwd(), prefix, outp= utfile) > + else: > + outputfileabs =3D outputfile > + return outputfileabs >=20 > def splitFile(inputfile, position, outputdir=3DNone, outputfile1=3DNone, > outputfile2=3DNone): > ''' > Split the inputfile into outputfile1 and outputfile2 from the positi= on. > ''' > logger =3D logging.getLogger('Split') >=20 > - inputfile =3D os.path.abspath(inputfile) > - workspace =3D os.path.dirname(inputfile) > if not os.path.exists(inputfile): > logger.error("File Not Found: %s" % inputfile) > raise(Exception) >=20 > if outputfile1 and outputfile2 and outputfile1 =3D=3D outputfile2: > logger.error( > "The firstfile and the secondfile can't be the same: %s" % o= utputfile1) > raise(Exception) >=20 > - if not outputdir: > - outputdir =3D workspace > - elif not os.path.isabs(outputdir): > - outputdir =3D os.path.join(workspace, outputdir) > - > # Create dir for the output files > try: > - if not outputfile1: > - outputfile1 =3D os.path.abspath(os.path.join( > - outputdir, "{}1".format(os.path.basename(inputfile)))) > - else: > - outputfile1 =3D os.path.abspath(os.path.join(outputdir, outp= utfile1)) > - outputdir =3D os.path.dirname(outputfile1) > - if not os.path.exists(outputdir): > - os.makedirs(outputdir) >=20 > - if not outputfile2: > - outputfile2 =3D os.path.abspath(os.path.join( > - outputdir, "{}2".format(os.path.basename(inputfile)))) > - else: > - outputfile2 =3D os.path.abspath(os.path.join(outputdir, outp= utfile2)) > - outputdir =3D os.path.dirname(outputfile2) > - if not os.path.exists(outputdir): > - os.makedirs(outputdir) > + outputfile1 =3D getoutputfileabs(inputfile, outputdir, outputfil= e1,1) > + outputfolder =3D os.path.dirname(outputfile1) > + if not os.path.exists(outputfolder): > + os.makedirs(outputfolder) > + > + outputfile2 =3D getoutputfileabs(inputfile, outputdir, outputfil= e2,2) > + outputfolder =3D os.path.dirname(outputfile2) > + if not os.path.exists(outputfolder): > + os.makedirs(outputfolder) > + > except Exception as e: > - logger.error("Can't make dir: %s" % outputdir) > + logger.error("Can't make dir: %s" % outputfolder) > raise(e) >=20 > if position <=3D 0: > - if outputfile2 !=3D inputfile: > - shutil.copy2(inputfile, outputfile2) > + if outputfile2 !=3D os.path.abspath(inputfile): > + shutil.copy2(os.path.abspath(inputfile), outputfile2) > with open(outputfile1, "wb") as fout: > fout.write(b'') > else: > inputfilesize =3D getFileSize(inputfile) > if position >=3D inputfilesize: > - if outputfile1 !=3D inputfile: > - shutil.copy2(inputfile, outputfile1) > + if outputfile1 !=3D os.path.abspath(inputfile): > + shutil.copy2(os.path.abspath(inputfile), outputfile1) > with open(outputfile2, "wb") as fout: > fout.write(b'') > else: > try: > tempdir =3D tempfile.mkdtemp() diff --git > a/BaseTools/Source/Python/tests/Split/test_split.py > b/BaseTools/Source/Python/tests/Split/test_split.py > index 82f71ecf5372..e4866be390b3 100644 > --- a/BaseTools/Source/Python/tests/Split/test_split.py > +++ b/BaseTools/Source/Python/tests/Split/test_split.py > @@ -16,30 +16,31 @@ import Split.Split as sp import struct as st >=20 >=20 > class TestSplit(unittest.TestCase): > def setUp(self): > - self.WORKSPACE =3D tempfile.mkdtemp() > - self.binary_file =3D os.path.join(self.WORKSPACE, "Binary.bin") > + self.tmpdir =3D tempfile.mkdtemp() > + self.binary_file =3D os.path.join(self.tmpdir, "Binary.bin") > self.create_inputfile() >=20 > def tearDown(self): > - if os.path.exists(self.WORKSPACE): > - shutil.rmtree(self.WORKSPACE) > + if os.path.exists(self.tmpdir): > + shutil.rmtree(self.tmpdir) >=20 > def test_splitFile_position(self): > position =3D [-1, 0, 256, 512, 700, 1024, 2048] > result =3D [(0, 1024), (0, 1024), (256, 768), > (512, 512), (700, 324), (1024, 0), (1024, 0)] > + outputfolder =3D self.tmpdir > for index, po in enumerate(position): > try: > sp.splitFile(self.binary_file, po) > except Exception as e: > self.assertTrue(False, msg=3D"splitFile function error") >=20 > - output1 =3D os.path.join(self.WORKSPACE, "Binary.bin1") > - output2 =3D os.path.join(self.WORKSPACE, "Binary.bin2") > + output1 =3D os.path.join(outputfolder, "Binary.bin1") > + output2 =3D os.path.join(outputfolder, "Binary.bin2") > with open(output1, "rb") as f1: > size1 =3D len(f1.read()) > with open(output2, "rb") as f2: > size2 =3D len(f2.read()) >=20 > @@ -51,61 +52,64 @@ class TestSplit(unittest.TestCase): > with open(self.binary_file, "wb") as fout: > for i in range(512): > fout.write(st.pack("=20 > def test_splitFile_outputfile(self): > - output =3D [None, "Binary.bin", "Binary1.bin", r"output/Binary1.= bin", > - os.path.join(self.WORKSPACE, r"output/Binary1.bin")] > - for o in output: > + output =3D [ > + None, > + "Binary.bin", > + "Binary1.bin", > + r"output/Binary1.bin", > + os.path.abspath( r"output/Binary1.bin") > + ] > + expected_output =3D [ > + os.path.join(os.path.dirname(self.binary_file),"Binary.bin1"= ), > + os.path.join(os.getcwd(),"Binary.bin"), > + os.path.join(os.getcwd(),"Binary1.bin"), > + os.path.join(os.getcwd(),r"output/Binary1.bin"), > + os.path.join(os.path.abspath( r"output/Binary1.bin")) > + ] > + for index, o in enumerate(output): > try: > sp.splitFile(self.binary_file, 123, outputfile1=3Do) > except Exception as e: > self.assertTrue(False, msg=3D"splitFile function error") > - if o is None: > - self.assertTrue(os.path.exists( > - os.path.join(self.WORKSPACE, "Binary.bin1"))) > - else: > - if os.path.isabs(o): > - self.assertTrue(os.path.exists(o)) > - else: > - self.assertTrue(os.path.exists( > - os.path.join(self.WORKSPACE, o))) > - self.create_inputfile() >=20 > - try: > - sp.splitFile(self.binary_file, 123, outputfile2=3Do) > - except Exception as e: > - self.assertTrue(False, msg=3D"splitFile function error") > - if o is None: > - self.assertTrue(os.path.exists( > - os.path.join(self.WORKSPACE, "Binary.bin2"))) > - else: > - if os.path.isabs(o): > - self.assertTrue(os.path.exists(o)) > - else: > - self.assertTrue(os.path.exists( > - os.path.join(self.WORKSPACE, o))) > + self.assertTrue(os.path.exists(expected_output[index])) > self.create_inputfile() >=20 > def test_splitFile_outputfolder(self): > - outputfolder =3D [None, "output", r"output1/output2", > - os.path.join(self.WORKSPACE, "output")] > - for o in outputfolder: > + outputfolder =3D [ > + None, > + "output", > + r"output1/output2", > + os.path.abspath("output"), > + "output" > + ] > + output =3D [ > + None, > + None, > + "Binary1.bin", > + r"output/Binary1.bin", > + os.path.abspath( r"output_1/Binary1.bin") > + ] > + > + expected_output =3D [ > + os.path.join(os.path.dirname(self.binary_file),"Binary.bin1"= ), > + os.path.join(os.getcwd(),"output", "Binary.bin1"), > + os.path.join(os.getcwd(), r"output1/output2" , "Binary1.bin"= ), > + os.path.join(os.getcwd(),r"output", "output/Binary1.bin"), > + os.path.join(os.path.abspath( r"output/Binary1.bin")) > + ] > + > + for index, o in enumerate(outputfolder): > try: > - sp.splitFile(self.binary_file, 123, outputdir=3Do) > + sp.splitFile(self.binary_file, 123, > + outputdir=3Do,outputfile1=3Doutput[index]) > except Exception as e: > self.assertTrue(False, msg=3D"splitFile function error") >=20 > - if o is None: > - self.assertTrue(os.path.exists( > - os.path.join(self.WORKSPACE, "Binary.bin1"))) > - else: > - if os.path.isabs(o): > - self.assertTrue(os.path.exists( > - os.path.join(o, "Binary.bin1"))) > - else: > - self.assertTrue(os.path.exists( > - os.path.join(self.WORKSPACE, o, "Binary.bin1"))) > + self.assertTrue(os.path.exists(expected_output[index])) > + self.create_inputfile() >=20 >=20 > if __name__ =3D=3D '__main__': > unittest.main() > -- > 2.29.1.windows.1