From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F3422A054A; Wed, 7 Sep 2022 18:37:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A3CF40143; Wed, 7 Sep 2022 18:37:41 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 3ACCA400D6 for ; Wed, 7 Sep 2022 18:37:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662568660; x=1694104660; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=oIunsXoGdz1K4UhqoQ4bY4jGcZKNnIDQxPW3slqS2fE=; b=D6bJMUAuySiBLKuyOM9upcVy0PxdOVk0GNDC7uIjw9sFKFNa+hcYw7vb hmEVgSyEuybw/q5ycwQtzpsjVCpUIrLb39kMH89Ye7sv66AuKb00nAgAw zm034o9oS44RsM8/M9Bmqt/X9MZuSM3pfFMEth85zYpTOaBXe8ofAfiDG lNYwedjw8pm8DGnFCuCovc04LAuBHvQg8NCOvZ55gz/Gv1ewCSqheUlK9 8NtLwLnNerb9kCUk5X47jpFaInQ2xRf5MNPXotMLA0so6joQw28F6Q/+v vvC40vk2OUCXCundZRNhjv81V+nwh8zsbQRQ75EKgilaOyKEWpvJ7Ho4k g==; X-IronPort-AV: E=McAfee;i="6500,9779,10463"; a="383223258" X-IronPort-AV: E=Sophos;i="5.93,297,1654585200"; d="scan'208";a="383223258" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 09:37:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,297,1654585200"; d="scan'208";a="647700647" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga001.jf.intel.com with ESMTP; 07 Sep 2022 09:37:38 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Sep 2022 09:37:37 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Sep 2022 09:37:37 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 7 Sep 2022 09:37:37 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 7 Sep 2022 09:37:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SgNvgqUQ7zLaCl+4qXBYZOFURdymd0MjS4KF6ADOOoUn6C6uSU+mBUnxbe81YiI/9x/WNXUF8vxweBqdYjScwNozw8lKv1tDqoJ0mg/2gDS2U8gCr8CgHP695FaWRc2iHpapRKS2z/sG/I4uWNvSxQxsbDljQpnAi1F+vXBiCoGK1xQgl/UI+n07/Z044kbOkcahiu3qL0nSbcZNFx57VwBS36/ZgALgI+BeT7KlrjPeixVRoad3JTt3Ag6w3l135m15b8l+1DKB5IhrCX81Jrq/4XDNaFFuUUtI9KTYGEtaxkUtsk7h1qjDsgbKaH0IZnt++GXWypHyG+zWoMS+bg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=97GQABUuwzjzzjgEI0b642GlMHwM1gQv2vB8e9zUzKA=; b=e8mm3f+NP8v5go9X1WwyVZKuM55zqjibpkXqGOGypTaMFm52dP78Cr+zR1EoyI16ii6kZgezwGsa2oukaNL+f4oFqwnq2P93eP14do7s1oB2Aa8c/f3nX2Ju8s0mTPjik0lNl8iU+70bLABBD94I9WSoQQl0ANe8yY2XvOR62bBTrB52qct8lXB65Zb7NP/rSDgtAEo1bkw5It7MkiyMSvvWuKH3mGbixeN/DLUYhSudu96LLl4bphKWk8QyBMl5hiiKoFYv/g84YfiLKLVJqVW/LkxI0ti2DbtxZkJn54mEScU3T+inQPM2R2f5J6+U6CzvbgUvQD9/8gkwfyjqtA== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) by MN2PR11MB3983.namprd11.prod.outlook.com (2603:10b6:208:137::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Wed, 7 Sep 2022 16:37:34 +0000 Received: from MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2]) by MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2%6]) with mapi id 15.20.5612.014; Wed, 7 Sep 2022 16:37:34 +0000 Date: Wed, 7 Sep 2022 17:37:27 +0100 From: Bruce Richardson To: Juraj =?utf-8?Q?Linke=C5=A1?= CC: , , , , , , Subject: Re: [PATCH v4 2/9] dts: add developer tools Message-ID: References: <20220728100044.1318484-1-juraj.linkes@pantheon.tech> <20220729105550.1382664-1-juraj.linkes@pantheon.tech> <20220729105550.1382664-3-juraj.linkes@pantheon.tech> Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220729105550.1382664-3-juraj.linkes@pantheon.tech> X-ClientProxiedBy: PR3P193CA0019.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:50::24) To MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR11MB1629:EE_|MN2PR11MB3983:EE_ X-MS-Office365-Filtering-Correlation-Id: 06c2069b-cb25-4f08-c43f-08da90ef4400 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z1V83kk4+DAC6HW8PwWEHcafrw1c4K7XmdkJQH0vEn5/FZOWdBXdZ1A0wwuVrdD6Kt0+TD5Wby6h3YQR5AraVO+UMKsTzscbDZeRSF6uhSS9N/WSHgkBASl1uu1ELqmikOn7WNfRO7GL8otBmx5QchaR9+XV0sWbF5hqe6y6Xh3dRSxcMlZGkE4bBATGHW56CupsDigSsftPNlpbhUt5CaOK3GrzLYFsTO1i1ZosaINa3NTOqnyl2BV5wlTlChvcgWMP+EdEzTrnQ3CBoACFtBDSgjJVaS+YLF8DO0Qree4vrPdTDz1Oze0YU0ZduMLvTOdARrVTf55wiSWyP8NSR20p2WgR9QfXw34/PFnKA0rUigjvFPNp8wVG1R0Z2n4p3ATIpXzXXQaMiTK9oVfImGqaJrpDT8/49S63+2Gdv8m060mory+V+0n73RfcJhFPV5q2PZ+49QGco0ki3mQZnt9RMBPmEtXlZ0Na4fKJsutGXJ++8Lu80liuOtMmU/GZaxcqpgviIBORMTckmqC5jYBTNZlf8LYRarWlMsGJA3tb7hPgw7S5eg0Fx6cFhLP94w9uhf7wbflq2pcfFLXC4uiexhRxLk2XwCch/tqWlR3YQJNZRuvpnuCtau+Hqes1UB9urrJKGOa2ESZjm194dGFO8LOD/N0s3a0OxGS/cVV8YPrFEiD25Xy+8nLINR6CWBLHObNHI/mvT8oqy+Hmy2vMnfRCFiYlwXniYFqwGFlEvCbIrzWkQ9uBwtJ/Qz/JB3PpaDolKTm+yCnJf7iOew== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1629.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39860400002)(366004)(376002)(346002)(396003)(136003)(45080400002)(6512007)(66556008)(6486002)(66476007)(966005)(66946007)(478600001)(2906002)(6506007)(86362001)(8936002)(8676002)(186003)(26005)(5660300002)(6666004)(82960400001)(41300700001)(4326008)(44832011)(316002)(38100700002)(6916009)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aDFOSWhBQTc4bmNoQkRSNXByMElJWENvYnpXcGs4YVo2OTF2YnJBTE1UdHo5?= =?utf-8?B?N0EvYXVkNCt3djE3T2liMW05aUk2SEl3b2EvNGFaT3lBVVRPcTJmc0NLcFNs?= =?utf-8?B?Q2lHcm5jWFNGVE85SnA4M3ZPS0RlVU5sUnNhOUtSUTREcndtbzNJdERmNnkv?= =?utf-8?B?YzRlbTZyL24vTTlac09TRWdDZ2ZlUUcvV1A4RmE3RW9aR3lBMy9aMXJ2QWFK?= =?utf-8?B?OEgwSyszVGlUTHdtMlhiQzZ5MzZMMmxPWmxxT0NSenEzbjRyUVM1QUpxU05s?= =?utf-8?B?SC9pYlFIRHBOckFFKzU5YVBWbnpiQlBwL0RKR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?utf-8?B?d254ejVTQ2x6RnpHRHVPaldDVDk4U0xIWEVpY1d2SU9nMVZBUzB1d1Fqdm5i?= =?utf-8?B?bGc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 06c2069b-cb25-4f08-c43f-08da90ef4400 X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1629.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 16:37:34.1643 (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: AichDQU0SY549O/yhKjCwM0S0Yhk76yiS0VjJeVY8B3ImheufjJJc30SShIvvyG3ttdVbO8dEm2pmrjS8lrV5be/a0ODOFLDCYv/NaLjFqQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3983 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Jul 29, 2022 at 10:55:43AM +0000, Juraj Linkeš wrote: > The Dockerfile contains basic image for CI and developers. There's also > an integration of the Dockerfile with Visual Studio. > > The formatter script uses Black and Isort to format the Python code. > > Signed-off-by: Owen Hilyard > Signed-off-by: Juraj Linkeš Comments inline below. Thanks, /Bruce > --- > dts/.devcontainer/devcontainer.json | 30 ++++++++++++ > dts/Dockerfile | 38 +++++++++++++++ > dts/README.md | 74 ++++++++++++++++++++++++++++- > dts/format.sh | 45 ++++++++++++++++++ > 4 files changed, 186 insertions(+), 1 deletion(-) > create mode 100644 dts/.devcontainer/devcontainer.json > create mode 100644 dts/Dockerfile > create mode 100755 dts/format.sh > > diff --git a/dts/.devcontainer/devcontainer.json b/dts/.devcontainer/devcontainer.json > new file mode 100644 > index 0000000000..41ca28fc17 > --- /dev/null > +++ b/dts/.devcontainer/devcontainer.json > @@ -0,0 +1,30 @@ > +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: > +// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/docker-existing-dockerfile > +{ > + "name": "Existing Dockerfile", > + > + // Sets the run context to one level up instead of the .devcontainer folder. > + "context": "..", > + > + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. > + "dockerFile": "../Dockerfile", > + > + // Use 'forwardPorts' to make a list of ports inside the container available locally. > + // "forwardPorts": [], > + > + // Uncomment the next line to run commands after the container is created - for example installing curl. > + "postCreateCommand": "poetry install", > + > + "extensions": [ > + "ms-python.vscode-pylance", > + ] > + > + // Uncomment when using a ptrace-based debugger like C++, Go, and Rust > + // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], > + > + // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker. > + // "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], > + > + // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. > + // "remoteUser": "vscode" > +} > diff --git a/dts/Dockerfile b/dts/Dockerfile > new file mode 100644 > index 0000000000..6700aa45b8 > --- /dev/null > +++ b/dts/Dockerfile > @@ -0,0 +1,38 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2022 University of New Hampshire > +# > + > +FROM ubuntu:22.04 AS base > + > +RUN apt-get -y update && apt-get -y upgrade && \ > + apt-get -y install --no-install-recommends \ > + python3 \ > + python3-pip \ > + python3-pexpect \ > + python3-poetry \ > + python3-cachecontrol \ > + openssh-client > + > + > +FROM base AS runner > + > +# This container is intended to be used as the base for automated systems. > +# It bakes DTS into the container during the build. > + > +RUN mkdir /dts > +COPY ./pyproject.toml /dts/pyproject.toml > +COPY ./poetry.lock /dts/poetry.lock > +WORKDIR /dts > +RUN poetry install --no-dev > +COPY . /dts Two questions here: * if we copy over the current folder, does it re-copy the same two files above, or do we get a new subfolder with the same name as the current one (and the two files in that instead)? * Can the commands be re-ordered so that we have all the copies together rather than being split either side of the workdir and run commands? > + > +CMD ["poetry", "run", "python", "main.py"] > + > +FROM base AS dev > + > +# This container is intended to be used as a development environment. > + > +RUN apt-get -y install --no-install-recommends \ > + vim emacs git > + If it's to be used as a development environment, do we not need build-essential installed? > +WORKDIR /dts Is this needed twice in the file, since it appears above too? > diff --git a/dts/README.md b/dts/README.md > index d8f88f97fe..55a272d767 100644 > --- a/dts/README.md > +++ b/dts/README.md > @@ -12,4 +12,76 @@ The Python Version required by DTS is specified in > [DTS python config file](./pyproject.toml) in the **[tool.poetry.dependencies]** > section. Poetry doesn't install Python, so you may need to satisfy this requirement if > your Python is not up to date. A tool such as [Pyenv](https://github.com/pyenv/pyenv) > -is a good way to get Python, though not the only one. > +is a good way to get Python, though not the only one. However, DTS includes a > +development environment in the form of a Docker image. > + > +# Expected Environment > + > +The expected execution and development environments for DTS are the same, > +the container defined by [Dockerfile](./Dockerfile). Using a container for the > +development environment helps with a few things. > + > +1. It helps enforce the boundary between the tester and the traffic > + generator/sut, something which has experienced issues in the past. s/experienced/caused/ > +2. It makes creating containers to run DTS inside automated tooling > + much easier, since they can be based off of a known-working environment > + that will be updated as DTS is. > +3. It abstracts DTS from the server it is running on. This means that the > + bare-metal os can be whatever corporate policy or your personal preferences > + dictate, and DTS does not have to try to support all 15 distros that > + are supported by DPDK CI. Remove the "15". > +4. It makes automated testing for DTS easier, since new dependencies can be > + sent in with the patches. > +5. It fixes the issue of undocumented dependencies, where some test suites > + require python libraries that are not installed. > +6. Allows everyone to use the same python version easily, even if they are > + using an LTS distro or Windows. Presumably the LTS distro is an *older* LTS distribution with possibly out-of-date packages? That should perhaps be made clearer. > +7. Allows you to run the tester on Windows while developing via Docker for > + Windows. > + > +## Tips for setting up a development environment > + > +### Getting a docker shell > + > +These commands will give you a bash shell inside the container with all the python > +dependencies installed. This will place you inside a python virtual > +environment. DTS is mounted via a volume, which is essentially a symlink > +from the host to the container. This enables you to edit and run inside the container > +and then delete the container when you are done, keeping your work. > + > +```shell > +docker build --target dev -t dpdk-dts . > +docker run -v $(pwd):/dts -it dpdk-dts bash > +$ poetry install > +$ poetry shell > +``` > + > +### Vim/Emacs > + > +Any editor in the ubuntu repos should be easy to use. You can add your normal > +config files as a volume, enabling you to use your preferred settings. > + > +```shell > +apt install vim > +apt install emacs > +``` Were these not already installed in the image created using the dockerfile above? > + > +### Visual Studio Code > + > +VSCode has first-class support for developing with containers. You may need to run the > +non-docker setup commands in the integrated terminal. DTS contains a .devcontainer > +config, so if you open the folder in vscode it should prompt you to use the dev > +container assuming you have the plugin installed. Please refer to > +[VS Development Containers Docs](https://code.visualstudio.com/docs/remote/containers) > +to set it all up. > + > +### Other > + > +Searching for '$IDE dev containers' will probably lead you in the right > +direction. > + > +# Python Formatting > + > +The tools used to format Python code in DTS are Black and Isort. There's a shell > +script, function.sh, which runs the formatters. Poetry will install these tools, > +so once you have that set up, you should run it before submitting patches. > diff --git a/dts/format.sh b/dts/format.sh > new file mode 100755 > index 0000000000..7d72335470 > --- /dev/null > +++ b/dts/format.sh > @@ -0,0 +1,45 @@ > +#!/usr/bin/env bash > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2022 University of New Hampshire > +# Copyright(c) 2022 PANTHEON.tech s.r.o. > +# > + > +function main() { > + # The directory to work on is either passed in as argument 1, > + # or is the current working directory > + DIRECTORY=${1:-$(pwd)} > + LINE_LENGTH=88 > + > + BLACK_VERSION=$(awk '/\[tool.poetry.dev-dependencies\]/,/$^/' pyproject.toml |\ > + grep black | grep -o '[0-9][^"]*') > + > + PYTHON_VERSION=$(awk '/\[tool.poetry.dependencies\]/,/$^/' pyproject.toml |\ > + grep python | grep -o '[0-9][^"]*' | tr -d '.') > + > + isort \ > + --overwrite-in-place \ > + --profile black \ > + -j "$(nproc)" \ > + --line-length $LINE_LENGTH \ > + --python-version auto \ > + "$DIRECTORY" > + > + black \ > + --line-length $LINE_LENGTH \ > + --required-version "${BLACK_VERSION}" \ > + --target-version "py${PYTHON_VERSION}" \ > + --safe \ > + "$DIRECTORY" > +} > + > +function help() { > + echo "usage: format.sh " > +} > + > +if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then > + help > + exit 0 > +fi > + > +main "$1" > + > -- > 2.30.2 >