How to use build_dir method in avocado

Best Python code snippet using avocado_python

deploy.py

Source:deploy.py Github

copy

Full Screen

1import sys2import os3import shutil4import zipfile5# get the directory the script is in 6current_dir = os.path.dirname(sys.argv[0]) + '\\'7deploy_dir = 'TUM Open Infra Platform'8deploy_path = current_dir + deploy_dir9def DeleteFiles(directory, extension):10 for root, dirs, files in os.walk(directory):11 for file in files:12 if file.endswith(extension):13 print(os.path.join(root, file))14 os.remove(os.path.join(root, file))15def DetermineCurrentRevison():16 text = os.popen('hg log -l 1').read()17 revision = text[13:17] # extract revision number18 irev = int(revision) + 119 return str(irev) 20 21def clean():22 shutil.rmtree(deploy_path)23 shutil.rmtree(deploy_path + '_' + DetermineCurrentRevison())24 25def deploy():26 os.environ["LANGUAGE"] = "en_US.UTF-8"27 28 # check if the build directory was passed29 if len(sys.argv) != 2: 30 print('No build directory was passed!')31 return32 33 build_dir = sys.argv[1] # "C:/build/vs2013/OpenInfraPlatform/"34 if not build_dir.endswith('\\'):35 build_dir = build_dir + '\\'36 37 # clean if the path already exists38 if os.path.isdir(deploy_path):39 shutil.rmtree(deploy_path) 40 41 # create the directory42 os.mkdir(deploy_path)43 44 # OpenInfraPlatform45 shutil.copy(build_dir + 'Release/OpenInfraPlatform.UI.exe', deploy_path + '/TUM Open Infra Platform.exe')46 shutil.copy(build_dir + 'Release/OpenInfraPlatform.CommandLineUtilities.exe', deploy_path + '/OpenInfraPlatform.CommandLineUtilities.exe')47 shutil.copy(build_dir + 'Release/OpenInfraPlatform.IfcBridgeGenerator.exe', deploy_path + '/OpenInfraPlatform.IfcBridgeGenerator.exe')48 shutil.copy(build_dir + 'Release/OpenInfraPlatform.IfcTunnelGenerator.exe', deploy_path + '/OpenInfraPlatform.IfcTunnelGenerator.exe')49 shutil.copy(build_dir + 'Release/OpenInfraPlatform.Infrastructure.dll', deploy_path + '/OpenInfraPlatform.Infrastructure.dll')50 51 # BlueFramework52 shutil.copy(build_dir + 'Release/BlueFramework.Core.dll', deploy_path + '/BlueFramework.Core.dll')53 shutil.copy(build_dir + 'Release/BlueFramework.ImageProcessing.dll', deploy_path + '/BlueFramework.ImageProcessing.dll')54 shutil.copy(build_dir + 'Release/BlueFramework.Rasterizer.dll', deploy_path + '/BlueFramework.Rasterizer.dll')55 shutil.copy(build_dir + 'Release/BlueFramework.Engine.dll', deploy_path + '/BlueFramework.Engine.dll')56 shutil.copy(build_dir + 'Release/BlueFramework.Application.dll', deploy_path + '/BlueFramework.Application.dll') 57 shutil.copy(build_dir + 'Release/BlueFramework.D3D11RenderSystem.dll', deploy_path + '/BlueFramework.D3D11RenderSystem.dll')58 shutil.copy(build_dir + 'Release/BlueFramework.GL4xRenderSystem.dll', deploy_path + '/BlueFramework.GL4xRenderSystem.dll') 59 shutil.copy(build_dir + 'Release/assimp-vc140-mt.dll', deploy_path + '/assimp-vc140-mt.dll')60 61 # ThirdParty62 shutil.copy(build_dir + 'Release/QtXlsxWriter.dll', deploy_path + '/QtXlsxWriter.dll')63 shutil.copy(build_dir + 'Release/liblas.dll', deploy_path + '/liblas.dll')64 65 # Qt66 shutil.copy(build_dir + 'Release/Qt5Core.dll', deploy_path + '/Qt5Core.dll')67 shutil.copy(build_dir + 'Release/Qt5Widgets.dll', deploy_path + '/Qt5Widgets.dll')68 shutil.copy(build_dir + 'Release/Qt5Gui.dll', deploy_path + '/Qt5Gui.dll')69 shutil.copy(build_dir + 'Release/Qt5Network.dll', deploy_path + '/Qt5Network.dll')70 shutil.copy(build_dir + 'Release/Qt5OpenGL.dll', deploy_path + '/Qt5OpenGL.dll')71 shutil.copy(build_dir + 'Release/Qt5Script.dll', deploy_path + '/Qt5Script.dll')72 shutil.copy(build_dir + 'Release/Qt5Xml.dll', deploy_path + '/Qt5Xml.dll')73 shutil.copy(build_dir + 'Release/Qt5XmlPatterns.dll', deploy_path + '/Qt5XmlPatterns.dll')74 shutil.copy(build_dir + 'Release/Qt5Sql.dll', deploy_path + '/Qt5Sql.dll') 75 shutil.copy(build_dir + 'Release/Qt5WebChannel.dll', deploy_path + '/Qt5WebChannel.dll') 76 shutil.copy(build_dir + 'Release/Qt5Multimedia.dll', deploy_path + '/Qt5Multimedia.dll')77 shutil.copy(build_dir + 'Release/Qt5MultimediaWidgets.dll', deploy_path + '/Qt5MultimediaWidgets.dll')78 shutil.copy(build_dir + 'Release/Qt5PrintSupport.dll', deploy_path + '/Qt5PrintSupport.dll')79 shutil.copy(build_dir + 'Release/Qt5Sensors.dll', deploy_path + '/Qt5Sensors.dll')80 shutil.copy(build_dir + 'Release/Qt5Svg.dll', deploy_path + '/Qt5Svg.dll')81 shutil.copy(build_dir + 'Release/Qt5Quick.dll', deploy_path + '/Qt5Quick.dll')82 shutil.copy(build_dir + 'Release/Qt5Qml.dll', deploy_path + '/Qt5Qml.dll')83 shutil.copy(build_dir + 'Release/Qt5Positioning.dll', deploy_path + '/Qt5Positioning.dll')84 shutil.copy(build_dir + 'Release/libGLESv2.dll', deploy_path + '/libGLESv2.dll')85 shutil.copy(build_dir + 'Release/libEGL.dll', deploy_path + '/libEGL.dll')86 shutil.copy(build_dir + 'Release/icudt54.dll', deploy_path + '/icudt54.dll')87 shutil.copy(build_dir + 'Release/icuin54.dll', deploy_path + '/icuin54.dll')88 shutil.copy(build_dir + 'Release/icuuc54.dll', deploy_path + '/icuuc54.dll')89 90 os.mkdir(deploy_path + '/plugins')91 os.mkdir(deploy_path + '/plugins/imageformats')92 # don't copy debug files and don't copy pdb files93 shutil.copy(build_dir + 'Release/plugins/imageformats/qdds.dll', deploy_path + '/plugins/imageformats/qdds.dll')94 shutil.copy(build_dir + 'Release/plugins/imageformats/qgif.dll', deploy_path + '/plugins/imageformats/qgif.dll')95 shutil.copy(build_dir + 'Release/plugins/imageformats/qicns.dll', deploy_path + '/plugins/imageformats/qicns.dll')96 shutil.copy(build_dir + 'Release/plugins/imageformats/qico.dll', deploy_path + '/plugins/imageformats/qico.dll')97 #shutil.copy(build_dir + 'Release/plugins/imageformats/qjp2.dll', deploy_path + '/plugins/imageformats/qjp2.dll')98 shutil.copy(build_dir + 'Release/plugins/imageformats/qjpeg.dll', deploy_path + '/plugins/imageformats/qjpeg.dll')99 #shutil.copy(build_dir + 'Release/plugins/imageformats/qmng.dll', deploy_path + '/plugins/imageformats/qmng.dll')100 shutil.copy(build_dir + 'Release/plugins/imageformats/qsvg.dll', deploy_path + '/plugins/imageformats/qsvg.dll')101 shutil.copy(build_dir + 'Release/plugins/imageformats/qtga.dll', deploy_path + '/plugins/imageformats/qtga.dll')102 shutil.copy(build_dir + 'Release/plugins/imageformats/qtiff.dll', deploy_path + '/plugins/imageformats/qtiff.dll')103 shutil.copy(build_dir + 'Release/plugins/imageformats/qwbmp.dll', deploy_path + '/plugins/imageformats/qwbmp.dll')104 shutil.copy(build_dir + 'Release/plugins/imageformats/qwebp.dll', deploy_path + '/plugins/imageformats/qwebp.dll')105 106 shutil.copytree(current_dir + 'platforms', deploy_path + '/platforms')107 108 # Oklabi109 shutil.copy(build_dir + 'Release/OklabiGdal1264.dll', deploy_path + '/OklabiGdal1264.dll')110 shutil.copy(build_dir + 'Release/OklabiGeos1264_c.dll', deploy_path + '/OklabiGeos1264_c.dll')111 shutil.copy(build_dir + 'Release/OklabiKern1264.dll', deploy_path + '/OklabiKern1264.dll')112 shutil.copy(build_dir + 'Release/OklabiProj1264.dll', deploy_path + '/OklabiProj1264.dll')113 shutil.copy(build_dir + 'Release/OklabiZlib1264.dll', deploy_path + '/OklabiZlib1264.dll')114 115 shutil.copytree(build_dir + 'res', deploy_path + '/res')116 shutil.copytree(build_dir + 'schema', deploy_path + '/schema')117 shutil.copytree(build_dir + 'fbliste', deploy_path + '/fbliste')118 119 # Zlib120 #shutil.copy(build_dir + 'Release/zlib1.dll', deploy_path + '/zlib1.dll')121 122 # DirectX123 shutil.copy(current_dir + 'D3DRedist/D3D/x64/d3dcompiler_47.dll', deploy_path + '/d3dcompiler_47.dll')124 125 # QSimpleUpdater126 shutil.copy(current_dir + '../external/QSimpleUpdater/libeay32.dll', deploy_path + '/libeay32.dll')127 shutil.copy(current_dir + '../external/QSimpleUpdater/ssleay32.dll', deploy_path + '/ssleay32.dll')128 129 # VS2013 Redist x64130 shutil.copy(current_dir + 'VC2013/redist/x64/Microsoft.VC120.CRT/msvcp120.dll', deploy_path + '/msvcp120.dll') # Standard C++ library for native code131 shutil.copy(current_dir + 'VC2013/redist/x64/Microsoft.VC120.CRT/msvcr120.dll', deploy_path + '/msvcr120.dll') # C runtime library (CRT) for native code132 shutil.copy(current_dir + 'VC2013/redist/x64/Microsoft.VC120.CRT/vccorlib120.dll', deploy_path + '/vccorlib120.dll') # WinRT core library133 shutil.copy(current_dir + 'VC2013/redist/x64/Microsoft.VC120.OpenMP/vcomp120.dll', deploy_path + '/vcomp120.dll') # OpenMP134 135 # VS2015 Redist x64136 shutil.copy(current_dir + 'VC2015/redist/x64/Microsoft.VC140.CRT/msvcp140.dll', deploy_path + '/msvcp140.dll') # Standard C++ library for native code137 shutil.copy(current_dir + 'VC2015/redist/x64/Microsoft.VC140.CRT/vcruntime140.dll', deploy_path + '/vcruntime140.dll') # C runtime library (CRT) for native code138 shutil.copy(current_dir + 'VC2015/redist/x64/Microsoft.VC140.CRT/vccorlib140.dll', deploy_path + '/vccorlib140.dll') # WinRT core library139 shutil.copy(current_dir + 'VC2015/redist/x64/Microsoft.VC140.OpenMP/vcomp140.dll', deploy_path + '/vcomp140.dll') # OpenMP140 141 # Python142 shutil.copy(current_dir + 'python/python35.dll', deploy_path + '/python35.dll') 143 shutil.copy(build_dir + 'Release/OpenInfraPlatform.Infrastructure.dll', deploy_path + '/Infrastructure.pyd')144 shutil.copy(current_dir + '../Infrastructure.Python/import.py', deploy_path + '/import.py')145 146 # data, shaders, etc.147 shutil.copytree(build_dir + 'Data', deploy_path + '/Data')148 # Remove data files that are not needed149 DeleteFiles(deploy_path + "/Data", ".svg") # textures150 DeleteFiles(deploy_path + "/Data/translations", ".ts") # linguist files151 # Shader152 os.mkdir(deploy_path + '/Shader')153 os.mkdir(deploy_path + '/Shader/D3D11')154 #os.mkdir(deploy + '/Shader/GL4x')155 156 shutil.copy(build_dir + 'Shader/D3D11/compileFXC.bat', deploy_path + '/Shader/D3D11/compileFXC.bat');157 158 shutil.copy(build_dir + 'Shader/D3D11/DigitalElevationModel.hlsl', deploy_path + '/Shader/D3D11/DigitalElevationModel.hlsl');159 shutil.copy(build_dir + 'Shader/D3D11/drawQuad.hlsl', deploy_path + '/Shader/D3D11/drawQuad.hlsl');160 shutil.copy(build_dir + 'Shader/D3D11/GBuffer.hlsl', deploy_path + '/Shader/D3D11/GBuffer.hlsl');161 shutil.copy(build_dir + 'Shader/D3D11/GradientQuad.hlsl', deploy_path + '/Shader/D3D11/GradientQuad.hlsl');162 shutil.copy(build_dir + 'Shader/D3D11/LaserScanPoint.hlsl', deploy_path + '/Shader/D3D11/LaserScanPoint.hlsl');163 shutil.copy(build_dir + 'Shader/D3D11/ViewCube.hlsl', deploy_path + '/Shader/D3D11/ViewCube.hlsl');164 shutil.copy(build_dir + 'Shader/D3D11/Skybox.hlsl', deploy_path + '/Shader/D3D11/Skybox.hlsl');165 shutil.copy(build_dir + 'Shader/D3D11/SkyboxPT.hlsl', deploy_path + '/Shader/D3D11/SkyboxPT.hlsl');166 shutil.copy(build_dir + 'Shader/D3D11/SkyboxPT.hlsl', deploy_path + '/Shader/D3D11/SpriteBatch.hlsl');167 shutil.copy(build_dir + 'Shader/D3D11/Text.hlsl', deploy_path + '/Shader/D3D11/Text.hlsl');168 shutil.copy(build_dir + 'Shader/D3D11/VertexCacheLine.hlsl', deploy_path + '/Shader/D3D11/VertexCacheLine.hlsl');169 shutil.copy(build_dir + 'Shader/D3D11/VertexCachePoint.hlsl', deploy_path + '/Shader/D3D11/VertexCachePoint.hlsl');170 shutil.copy(build_dir + 'Shader/D3D11/VertexCacheTriangle.hlsl', deploy_path + '/Shader/D3D11/VertexCacheTriangle.hlsl');171 shutil.copy(build_dir + 'Shader/D3D11/VertexCacheTriangleTextured.hlsl', deploy_path + '/Shader/D3D11/VertexCacheTriangleTextured.hlsl');172 shutil.copy(build_dir + 'Shader/D3D11/VertexCacheLineAlignment.hlsl', deploy_path + '/Shader/D3D11/VertexCacheLineAlignment.hlsl');173 shutil.copy(build_dir + 'Shader/D3D11/VertexCacheLineAlignmentPick.hlsl', deploy_path + '/Shader/D3D11/VertexCacheLineAlignmentPick.hlsl');174 175 shutil.copytree(build_dir + 'Shader/GL4x/', deploy_path + '/Shader/GL4x')176 # now compile shaders177 os.chdir(deploy_path)178 os.chdir('Shader')179 os.chdir('D3D11')180 os.system('compileFXC.bat')181 os.chdir('..')182 os.chdir('..')183 os.chdir('..')184 # remove shader source files185 os.remove(deploy_path + '/Shader/D3D11/compileFXC.bat')186 os.remove(deploy_path + '/Shader/D3D11/DigitalElevationModel.hlsl')187 os.remove(deploy_path + '/Shader/D3D11/drawQuad.hlsl')188 os.remove(deploy_path + '/Shader/D3D11/GBuffer.hlsl')189 os.remove(deploy_path + '/Shader/D3D11/GradientQuad.hlsl')190 os.remove(deploy_path + '/Shader/D3D11/ViewCube.hlsl') 191 os.remove(deploy_path + '/Shader/D3D11/Skybox.hlsl')192 os.remove(deploy_path + '/Shader/D3D11/SkyboxPT.hlsl')193 os.remove(deploy_path + '/Shader/D3D11/SpriteBatch.hlsl')194 os.remove(deploy_path + '/Shader/D3D11/Text.hlsl')195 os.remove(deploy_path + '/Shader/D3D11/VertexCacheLine.hlsl')196 os.remove(deploy_path + '/Shader/D3D11/VertexCachePoint.hlsl')197 os.remove(deploy_path + '/Shader/D3D11/VertexCacheTriangle.hlsl')198 os.remove(deploy_path + '/Shader/D3D11/VertexCacheTriangleTextured.hlsl')199 os.remove(deploy_path + '/Shader/D3D11/LaserScanPoint.hlsl')200 os.remove(deploy_path + '/Shader/D3D11/VertexCacheLineAlignment.hlsl')201 os.remove(deploy_path + '/Shader/D3D11/VertexCacheLineAlignmentPick.hlsl')202 203 # copy BlueEffect files.204 shutil.copy(build_dir + 'Shader/DigitalElevationModel.be', deploy_path + '/Shader/DigitalElevationModel.be');205 shutil.copy(build_dir + 'Shader/LaserScanPoint.be', deploy_path + '/Shader/LaserScanPoint.be');206 shutil.copy(build_dir + 'Shader/Skybox.be', deploy_path + '/Shader/Skybox.be');207 shutil.copy(build_dir + 'Shader/VertexCacheLine.be', deploy_path + '/Shader/VertexCacheLine.be');208 shutil.copy(build_dir + 'Shader/VertexCachePoint.be', deploy_path + '/Shader/VertexCachePoint.be');209 shutil.copy(build_dir + 'Shader/VertexCacheTriangle.be', deploy_path + '/Shader/VertexCacheTriangle.be');210 shutil.copy(build_dir + 'Shader/VertexCacheLineAlignment.be', deploy_path + '/Shader/VertexCacheLineAlignment.be');211 shutil.copy(build_dir + 'Shader/VertexCacheLineAlignmentPick.be', deploy_path + '/Shader/VertexCacheLineAlignmentPick.be');212 213 # Style folder214 os.mkdir(deploy_path + '/Style')215 shutil.copy(build_dir + 'Style/blueform.qss', deploy_path + '/Style/blueform.qss')216 217 # testdata218 os.mkdir(deploy_path + '/testdata')219 os.mkdir(deploy_path + '/testdata/LandXML')220 os.mkdir(deploy_path + '/testdata/IfcAlignment')221 222 shutil.copy(build_dir + 'testdata/LandXML/Mainbruecke_Klingenberg.xml', deploy_path + '/testdata/LandXML/Mainbruecke_Klingenberg.xml')223 shutil.copy(build_dir + 'testdata/LandXML/AutoCAD Civil 3D/Land1.xml', deploy_path + '/testdata/LandXML/Land1.xml')224 # License file225 shutil.copy('../docs/licenses.txt', deploy_path + '/licenses.txt')226 227 # Zip file228 zipFilename = deploy_dir + '_' + DetermineCurrentRevison() 229 newFilename = zipFilename + "\\" + zipFilename230 231 shutil.copytree(deploy_path, newFilename) 232 shutil.make_archive(zipFilename, "zip", zipFilename)233 234 # Clean235 clean()236 ...

Full Screen

Full Screen

kunit_kernel.py

Source:kunit_kernel.py Github

copy

Full Screen

1# SPDX-License-Identifier: GPL-2.02#3# Runs UML kernel, collects output, and handles errors.4#5# Copyright (C) 2019, Google LLC.6# Author: Felix Guo <felixguoxiuping@gmail.com>7# Author: Brendan Higgins <brendanhiggins@google.com>8import logging9import subprocess10import os11import shutil12import signal13from contextlib import ExitStack14import kunit_config15import kunit_parser16KCONFIG_PATH = '.config'17KUNITCONFIG_PATH = '.kunitconfig'18DEFAULT_KUNITCONFIG_PATH = 'arch/um/configs/kunit_defconfig'19BROKEN_ALLCONFIG_PATH = 'tools/testing/kunit/configs/broken_on_uml.config'20OUTFILE_PATH = 'test.log'21class ConfigError(Exception):22 """Represents an error trying to configure the Linux kernel."""23class BuildError(Exception):24 """Represents an error trying to build the Linux kernel."""25class LinuxSourceTreeOperations(object):26 """An abstraction over command line operations performed on a source tree."""27 def make_mrproper(self):28 try:29 subprocess.check_output(['make', 'mrproper'], stderr=subprocess.STDOUT)30 except OSError as e:31 raise ConfigError('Could not call make command: ' + str(e))32 except subprocess.CalledProcessError as e:33 raise ConfigError(e.output.decode())34 def make_olddefconfig(self, build_dir, make_options):35 command = ['make', 'ARCH=um', 'olddefconfig']36 if make_options:37 command.extend(make_options)38 if build_dir:39 command += ['O=' + build_dir]40 try:41 subprocess.check_output(command, stderr=subprocess.STDOUT)42 except OSError as e:43 raise ConfigError('Could not call make command: ' + str(e))44 except subprocess.CalledProcessError as e:45 raise ConfigError(e.output.decode())46 def make_allyesconfig(self, build_dir, make_options):47 kunit_parser.print_with_timestamp(48 'Enabling all CONFIGs for UML...')49 command = ['make', 'ARCH=um', 'allyesconfig']50 if make_options:51 command.extend(make_options)52 if build_dir:53 command += ['O=' + build_dir]54 process = subprocess.Popen(55 command,56 stdout=subprocess.DEVNULL,57 stderr=subprocess.STDOUT)58 process.wait()59 kunit_parser.print_with_timestamp(60 'Disabling broken configs to run KUnit tests...')61 with ExitStack() as es:62 config = open(get_kconfig_path(build_dir), 'a')63 disable = open(BROKEN_ALLCONFIG_PATH, 'r').read()64 config.write(disable)65 kunit_parser.print_with_timestamp(66 'Starting Kernel with all configs takes a few minutes...')67 def make(self, jobs, build_dir, make_options):68 command = ['make', 'ARCH=um', '--jobs=' + str(jobs)]69 if make_options:70 command.extend(make_options)71 if build_dir:72 command += ['O=' + build_dir]73 try:74 proc = subprocess.Popen(command,75 stderr=subprocess.PIPE,76 stdout=subprocess.DEVNULL)77 except OSError as e:78 raise BuildError('Could not call make command: ' + str(e))79 _, stderr = proc.communicate()80 if proc.returncode != 0:81 raise BuildError(stderr.decode())82 if stderr: # likely only due to build warnings83 print(stderr.decode())84 def linux_bin(self, params, timeout, build_dir):85 """Runs the Linux UML binary. Must be named 'linux'."""86 linux_bin = './linux'87 if build_dir:88 linux_bin = os.path.join(build_dir, 'linux')89 outfile = get_outfile_path(build_dir)90 with open(outfile, 'w') as output:91 process = subprocess.Popen([linux_bin] + params,92 stdout=output,93 stderr=subprocess.STDOUT)94 process.wait(timeout)95def get_kconfig_path(build_dir):96 kconfig_path = KCONFIG_PATH97 if build_dir:98 kconfig_path = os.path.join(build_dir, KCONFIG_PATH)99 return kconfig_path100def get_kunitconfig_path(build_dir):101 kunitconfig_path = KUNITCONFIG_PATH102 if build_dir:103 kunitconfig_path = os.path.join(build_dir, KUNITCONFIG_PATH)104 return kunitconfig_path105def get_outfile_path(build_dir):106 outfile_path = OUTFILE_PATH107 if build_dir:108 outfile_path = os.path.join(build_dir, OUTFILE_PATH)109 return outfile_path110class LinuxSourceTree(object):111 """Represents a Linux kernel source tree with KUnit tests."""112 def __init__(self):113 self._ops = LinuxSourceTreeOperations()114 signal.signal(signal.SIGINT, self.signal_handler)115 def clean(self):116 try:117 self._ops.make_mrproper()118 except ConfigError as e:119 logging.error(e)120 return False121 return True122 def create_kunitconfig(self, build_dir, defconfig=DEFAULT_KUNITCONFIG_PATH):123 kunitconfig_path = get_kunitconfig_path(build_dir)124 if not os.path.exists(kunitconfig_path):125 shutil.copyfile(defconfig, kunitconfig_path)126 def read_kunitconfig(self, build_dir):127 kunitconfig_path = get_kunitconfig_path(build_dir)128 self._kconfig = kunit_config.Kconfig()129 self._kconfig.read_from_file(kunitconfig_path)130 def validate_config(self, build_dir):131 kconfig_path = get_kconfig_path(build_dir)132 validated_kconfig = kunit_config.Kconfig()133 validated_kconfig.read_from_file(kconfig_path)134 if not self._kconfig.is_subset_of(validated_kconfig):135 invalid = self._kconfig.entries() - validated_kconfig.entries()136 message = 'Provided Kconfig is not contained in validated .config. Following fields found in kunitconfig, ' \137 'but not in .config: %s' % (138 ', '.join([str(e) for e in invalid])139 )140 logging.error(message)141 return False142 return True143 def build_config(self, build_dir, make_options):144 kconfig_path = get_kconfig_path(build_dir)145 if build_dir and not os.path.exists(build_dir):146 os.mkdir(build_dir)147 self._kconfig.write_to_file(kconfig_path)148 try:149 self._ops.make_olddefconfig(build_dir, make_options)150 except ConfigError as e:151 logging.error(e)152 return False153 return self.validate_config(build_dir)154 def build_reconfig(self, build_dir, make_options):155 """Creates a new .config if it is not a subset of the .kunitconfig."""156 kconfig_path = get_kconfig_path(build_dir)157 if os.path.exists(kconfig_path):158 existing_kconfig = kunit_config.Kconfig()159 existing_kconfig.read_from_file(kconfig_path)160 if not self._kconfig.is_subset_of(existing_kconfig):161 print('Regenerating .config ...')162 os.remove(kconfig_path)163 return self.build_config(build_dir, make_options)164 else:165 return True166 else:167 print('Generating .config ...')168 return self.build_config(build_dir, make_options)169 def build_um_kernel(self, alltests, jobs, build_dir, make_options):170 try:171 if alltests:172 self._ops.make_allyesconfig(build_dir, make_options)173 self._ops.make_olddefconfig(build_dir, make_options)174 self._ops.make(jobs, build_dir, make_options)175 except (ConfigError, BuildError) as e:176 logging.error(e)177 return False178 return self.validate_config(build_dir)179 def run_kernel(self, args=[], build_dir='', timeout=None):180 args.extend(['mem=1G'])181 self._ops.linux_bin(args, timeout, build_dir)182 outfile = get_outfile_path(build_dir)183 subprocess.call(['stty', 'sane'])184 with open(outfile, 'r') as file:185 for line in file:186 yield line187 def signal_handler(self, sig, frame):188 logging.error('Build interruption occurred. Cleaning console.')...

Full Screen

Full Screen

setup_env.py

Source:setup_env.py Github

copy

Full Screen

...1213 if os.path.exists(self.build_dir):14 shutil.rmtree(self.build_dir)1516 self.create_build_dir()1718 self.copy_src()19 self.install_pyinstaller()20 self.install_upx()2122 def create_build_dir(self) -> None:23 if not os.path.exists(self.build_dir):24 os.mkdir(self.build_dir)2526 def copy_src(self) -> None:27 shutil.copytree(self.src_dir, self.build_dir + os.sep + 'src')2829 def install_pyinstaller(self) -> None:30 url = 'https://github.com/pyinstaller/pyinstaller/archive/refs/tags/v5.1.zip'3132 with requests.get(url, stream=True) as r:33 r.raise_for_status()34 with open(os.path.join(self.build_dir, 'pyinstaller.zip'), 'wb') as f:35 shutil.copyfileobj(r.raw, f)36 ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful