From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 3EFEF903 for ; Mon, 9 Feb 2015 14:03:59 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 09 Feb 2015 05:03:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,543,1418112000"; d="scan'208";a="649466043" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by orsmga001.jf.intel.com with ESMTP; 09 Feb 2015 05:03:57 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 9 Feb 2015 21:03:55 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.192]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.161]) with mapi id 14.03.0195.001; Mon, 9 Feb 2015 21:03:55 +0800 From: "Qiu, Michael" To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH] framework: change default running directory to parent directory Thread-Index: AQHQREkUHs8loxQNUUqR0wAxybPeow== Date: Mon, 9 Feb 2015 13:03:54 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CE71CB@SHSMSX101.ccr.corp.intel.com> References: <1423473356-2366-1-git-send-email-yong.liu@intel.com> <1423473775-2841-1-git-send-email-yong.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH] framework: change default running directory to parent directory X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2015 13:03:59 -0000 On 2/9/2015 5:25 PM, Yong Liu wrote:=0A= > Previous default running directory of DTS is under framework. This will c= ause =0A= > confusion sometimes.=0A= >=0A= > Signed-off-by: Marvinliu =0A= > ---=0A= > framework/config.py | 4 ++--=0A= > framework/dts.py | 13 ++++++++++---=0A= > framework/main.py | 14 +++++++-------=0A= > framework/rst.py | 4 ++--=0A= > framework/settings.py | 8 ++++++++=0A= > 5 files changed, 29 insertions(+), 14 deletions(-)=0A= >=0A= > diff --git a/framework/config.py b/framework/config.py=0A= > index af014a8..d2548e8 100755=0A= > --- a/framework/config.py=0A= > +++ b/framework/config.py=0A= > @@ -37,8 +37,8 @@ import re=0A= > import ConfigParser # config parse module=0A= > import argparse # prase arguments module=0A= > =0A= > -portconf =3D "../conf/ports.cfg"=0A= > -crbconf =3D "../conf/crbs.cfg"=0A= > +portconf =3D "conf/ports.cfg"=0A= > +crbconf =3D "conf/crbs.cfg"=0A= > =0A= > =0A= > class UserConf():=0A= > diff --git a/framework/dts.py b/framework/dts.py=0A= > index 9ba23fe..bddbe33 100644=0A= > --- a/framework/dts.py=0A= > +++ b/framework/dts.py=0A= > @@ -42,7 +42,7 @@ import rst # rst file support=0A= > from crbs import crbs=0A= > from tester import Tester=0A= > from dut import Dut=0A= > -from settings import NICS, DRIVERS=0A= > +from settings import FOLDERS, NICS, DRIVERS=0A= > from serializer import Serializer=0A= > from exception import VerifyFailure=0A= > from test_case import TestCase=0A= > @@ -128,7 +128,7 @@ def close_crb_sessions():=0A= > dut.close()=0A= > if tester is not None:=0A= > tester.close()=0A= > - log_handler.info("DTF ended")=0A= > + log_handler.info("DTS ended")=0A= > =0A= > =0A= > def get_nic_driver(pci_id):=0A= > @@ -401,10 +401,18 @@ def run_all(config_file, pkgName, git, patch, skip_= setup,=0A= > global stats=0A= > global log_handler=0A= > =0A= > + # change operation directory=0A= > + os.chdir("../")=0A= > +=0A= > # prepare the output folder=0A= > if not os.path.exists(output_dir):=0A= > os.mkdir(output_dir)=0A= > =0A= > + # add python module search path=0A= > + for folder in FOLDERS.values():=0A= > + sys.path.append(folder)=0A= > + sys.path.append(suite_dir)=0A= > +=0A= > # init log_handler handler=0A= > if verbose is True:=0A= > logger.set_verbose()=0A= > @@ -423,7 +431,6 @@ def run_all(config_file, pkgName, git, patch, skip_se= tup,=0A= > # register exit action=0A= > atexit.register(close_crb_sessions)=0A= > =0A= > - sys.path.append(suite_dir)=0A= > os.environ["TERM"] =3D "dumb"=0A= > =0A= > serializer =3D Serializer()=0A= > diff --git a/framework/main.py b/framework/main.py=0A= > index 21815dd..d38aa8a 100755=0A= > --- a/framework/main.py=0A= > +++ b/framework/main.py=0A= > @@ -47,9 +47,9 @@ def git_build_package(gitLabel, gitPkg, output):=0A= > gitURL =3D r"http://dpdk.org/git/dpdk"=0A= > gitPrefix =3D r"dpdk/"=0A= > print "git clone %s %s/%s" % (gitURL, output, gitPrefix)=0A= > - os.system("git clone %s ../output/%s" % (gitURL, gitPrefix))=0A= > - print "git archive --format=3Dtar.gz --prefix=3D%s %s -o ../%s" % (g= itPrefix, gitLabel, gitPkg)=0A= > - os.system("cd ../output/%s && git archive --format=3Dtar.gz --prefix= =3D%s %s -o ../%s" % (gitPrefix, gitPrefix, gitLabel, gitPkg))=0A= > + os.system("git clone %s output/%s" % (gitURL, gitPrefix))=0A= > + print "git archive --format=3Dtar.gz --prefix=3D%s %s -o %s" % (gitP= refix, gitLabel, gitPkg)=0A= > + os.system("cd output/%s && git archive --format=3Dtar.gz --prefix=3D= %s %s -o %s" % (gitPrefix, gitPrefix, gitLabel, gitPkg))=0A= =0A= Here better to add error handing(try catch) for those commands may=0A= failed by network issue.=0A= =0A= Thanks,=0A= Michael=0A= > =0A= > #=0A= > # Main program begins here=0A= > @@ -60,7 +60,7 @@ def git_build_package(gitLabel, gitPkg, output):=0A= > parser =3D argparse.ArgumentParser(description=3D'DPDK test framework.')= =0A= > =0A= > parser.add_argument('--config-file',=0A= > - default=3D'../execution.cfg',=0A= > + default=3D'execution.cfg',=0A= > help=3D'configuration file that describes the test '= +=0A= > 'cases, DUTs and targets')=0A= > =0A= > @@ -72,11 +72,11 @@ parser.add_argument('--patch',=0A= > help=3D'apply a patch to the package under test')=0A= > =0A= > parser.add_argument('--snapshot',=0A= > - default=3D'../dpdk.tar.gz',=0A= > + default=3D'dpdk.tar.gz',=0A= > help=3D'snapshot .tgz file to use as input')=0A= > =0A= > parser.add_argument('--output',=0A= > - default=3D'../output',=0A= > + default=3D'output',=0A= > help=3D'Output directory where dts log and result sa= ved')=0A= > =0A= > parser.add_argument('-s', '--skip-setup',=0A= > @@ -95,7 +95,7 @@ parser.add_argument('-p', '--project',=0A= > help=3D'specify that which project will be tested')= =0A= > =0A= > parser.add_argument('--suite-dir',=0A= > - default=3D'../tests',=0A= > + default=3D'tests',=0A= > help=3D'Test suite directory where test suites will = be imported')=0A= > =0A= > parser.add_argument('-t', '--test-cases',=0A= > diff --git a/framework/rst.py b/framework/rst.py=0A= > index 8c2d6c5..9b8eb69 100644=0A= > --- a/framework/rst.py=0A= > +++ b/framework/rst.py=0A= > @@ -52,8 +52,8 @@ Result:=0A= > Result: PASS=0A= > """=0A= > =0A= > -path2Plan =3D '../test_plans'=0A= > -path2Result =3D '../output'=0A= > +path2Plan =3D 'test_plans'=0A= > +path2Result =3D 'output'=0A= > rstName =3D ""=0A= > rstAnnexName =3D ""=0A= > =0A= > diff --git a/framework/settings.py b/framework/settings.py=0A= > index 40b81fb..e4ca5dd 100644=0A= > --- a/framework/settings.py=0A= > +++ b/framework/settings.py=0A= > @@ -28,6 +28,14 @@=0A= > # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT=0A= > # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE= =0A= > # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.= =0A= > +"""=0A= > +Folders for framework running enviornment.=0A= > +"""=0A= > +FOLDERS =3D {=0A= > + 'Framework' : 'framework',=0A= > + 'Testscripts' : 'tests',=0A= > + 'Configuration' : 'conf',=0A= > +}=0A= > =0A= > """=0A= > Nics and its identifiers supported by the framework.=0A= =0A=