Esempio n. 1
0
def shutdown_dotnet_servers():
    # shutdown_server(verbose=True) # This is the correct way to shut down dotnet build servers, but it has been disabled due to https://github.com/dotnet/sdk/issues/10573
    getLogger().info("Shutting down dotnet build servers...")
    if util.iswin():
        os.system(
            'TASKKILL /F /T /IM dotnet.exe || TASKKILL /F /T /IM VSTest.Console.exe || TASKKILL /F /T /IM msbuild.exe'
        )
    else:
        os.system(
            'killall -9 dotnet || killall -9 VSTest.Console || killall -9 msbuild'
        )
Esempio n. 2
0
    def run(self):
        '''
        Runs the specified scenario
        '''
        self.parseargs()
        if self.testtype == const.STARTUP:
            startup = StartupWrapper()
            self.traits.add_traits(
                overwrite=False,
                environmentvariables='COMPlus_EnableEventLog=1'
                if not iswin() else '',
                scenarioname=self.scenarioname,
                scenariotypename=const.SCENARIO_NAMES[const.STARTUP],
                apptorun=publishedexe(self.traits.exename),
            )
            startup.runtests(self.traits)

        elif self.testtype == const.SDK:
            startup = StartupWrapper()
            envlistbuild = 'DOTNET_MULTILEVEL_LOOKUP=0'
            envlistcleanbuild = ';'.join(
                ['MSBUILDDISABLENODEREUSE=1', envlistbuild])
            # clean build
            if self.sdktype == const.CLEAN_BUILD:
                self.traits.add_traits(
                    overwrite=False,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.CLEAN_BUILD),
                    apptorun=const.DOTNET,
                    appargs='build',
                    iterationsetup=pythoncommand(),
                    setupargs='%s %s setup_build' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    iterationcleanup=pythoncommand(),
                    cleanupargs='%s %s cleanup' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    workingdir=const.APPDIR,
                    environmentvariables=envlistcleanbuild,
                )
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

            # build(no changes)
            if self.sdktype == const.BUILD_NO_CHANGE:
                self.traits.add_traits(
                    overwrite=False,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.BUILD_NO_CHANGE),
                    apptorun=const.DOTNET,
                    appargs='build',
                    workingdir=const.APPDIR,
                    environmentvariables=envlistbuild)
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

            # new console
            if self.sdktype == const.NEW_CONSOLE:
                self.traits.add_traits(
                    overwrite=False,
                    appargs='new console',
                    apptorun=const.DOTNET,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.NEW_CONSOLE),
                    iterationsetup=pythoncommand(),
                    setupargs='%s %s setup_new' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    iterationcleanup=pythoncommand(),
                    cleanupargs='%s %s cleanup' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    workingdir=const.APPDIR)
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

        elif self.testtype == const.CROSSGEN:
            startup = StartupWrapper()
            crossgenexe = 'crossgen%s' % extension()
            crossgenargs = self.crossgen_arguments.get_crossgen_command_line()
            coreroot = self.crossgen_arguments.coreroot
            scenario_filename = self.crossgen_arguments.crossgen2_scenario_filename(
            )

            self.traits.add_traits(overwrite=True,
                                   startupmetric=const.STARTUP_PROCESSTIME,
                                   workingdir=coreroot,
                                   appargs=' '.join(crossgenargs))
            self.traits.add_traits(
                overwrite=False,
                scenarioname='Crossgen Throughput - %s' % scenario_filename,
                scenariotypename='%s - %s' %
                (const.SCENARIO_NAMES[const.CROSSGEN], scenario_filename),
                apptorun='%s\%s' % (coreroot, crossgenexe),
            )
            startup.runtests(self.traits)

        elif self.testtype == const.CROSSGEN2:
            startup = StartupWrapper()
            scenario_filename = self.crossgen_arguments.crossgen2_scenario_filename(
            )
            crossgen2args = self.crossgen_arguments.get_crossgen2_command_line(
            )
            compiletype = self.crossgen_arguments.crossgen2_compiletype()
            scenarioname = 'Crossgen2 Throughput - %s - %s' % (
                compiletype, scenario_filename)
            if self.crossgen_arguments.singlethreaded:
                scenarioname = 'Crossgen2 Throughput - Single Threaded - %s - %s' % (
                    compiletype, scenario_filename)

            if compiletype == const.CROSSGEN2_COMPOSITE:
                self.traits.add_traits(overwrite=True, skipprofile='true')

            self.traits.add_traits(
                overwrite=True,
                startupmetric=const.STARTUP_CROSSGEN2,
                workingdir=self.crossgen_arguments.coreroot,
                appargs='%s %s' % (os.path.join(
                    'crossgen2', 'crossgen2.dll'), ' '.join(crossgen2args)))
            self.traits.add_traits(
                overwrite=False,
                scenarioname=scenarioname,
                apptorun=os.path.join(self.crossgen_arguments.coreroot,
                                      'corerun%s' % extension()),
                environmentvariables='COMPlus_EnableEventLog=1'
                if not iswin() else ''  # turn on clr user events
            )
            startup.runtests(self.traits)

        elif self.testtype == const.SOD:
            sod = SODWrapper()
            builtdir = const.PUBDIR if os.path.exists(const.PUBDIR) else None
            if not builtdir:
                builtdir = const.BINDIR if os.path.exists(
                    const.BINDIR) else None
            if not (self.dirs or builtdir):
                raise Exception(
                    "Dirs was not passed in and neither %s nor %s exist" %
                    (const.PUBDIR, const.BINDIR))
            sod.runtests(scenarioname=self.scenarioname,
                         dirs=self.dirs or builtdir,
                         artifact=self.traits.artifact)
Esempio n. 3
0
    def run(self):
        '''
        Runs the specified scenario
        '''
        self.parseargs()
        if self.testtype == const.STARTUP:
            startup = StartupWrapper()
            self.traits.add_traits(
                overwrite=False,
                environmentvariables='COMPlus_EnableEventLog=1'
                if not iswin() else '',
                scenarioname=self.scenarioname,
                scenariotypename=const.SCENARIO_NAMES[const.STARTUP],
                apptorun=publishedexe(self.traits.exename),
            )
            startup.runtests(self.traits)

        elif self.testtype == const.SDK:
            startup = StartupWrapper()
            envlistbuild = 'DOTNET_MULTILEVEL_LOOKUP=0'
            envlistcleanbuild = ';'.join(
                ['MSBUILDDISABLENODEREUSE=1', envlistbuild])
            # clean build
            if self.sdktype == const.CLEAN_BUILD:
                self.traits.add_traits(
                    overwrite=False,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.CLEAN_BUILD),
                    apptorun=const.DOTNET,
                    appargs='build',
                    iterationsetup=pythoncommand(),
                    setupargs='%s %s setup_build' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    iterationcleanup=pythoncommand(),
                    cleanupargs='%s %s cleanup' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    workingdir=const.APPDIR,
                    environmentvariables=envlistcleanbuild,
                )
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

            # build(no changes)
            if self.sdktype == const.BUILD_NO_CHANGE:
                self.traits.add_traits(
                    overwrite=False,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.BUILD_NO_CHANGE),
                    apptorun=const.DOTNET,
                    appargs='build',
                    workingdir=const.APPDIR,
                    environmentvariables=envlistbuild)
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

            # new console
            if self.sdktype == const.NEW_CONSOLE:
                self.traits.add_traits(
                    overwrite=False,
                    appargs='new console',
                    apptorun=const.DOTNET,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.NEW_CONSOLE),
                    iterationsetup=pythoncommand(),
                    setupargs='%s %s setup_new' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    iterationcleanup=pythoncommand(),
                    cleanupargs='%s %s cleanup' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    workingdir=const.APPDIR)
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

        elif self.testtype == const.CROSSGEN:
            startup = StartupWrapper()
            crossgenexe = 'crossgen%s' % extension()
            filename, ext = os.path.splitext(self.crossgenfile)
            outputdir = os.path.join(os.getcwd(), 'crossgen.out')
            if not os.path.exists(outputdir):
                os.mkdir(outputdir)
            outputfile = os.path.join(outputdir, filename + '.ni' + ext)
            crossgenargs = '/nologo /out %s /p %s %s\%s' % (
                outputfile, self.coreroot, self.coreroot, self.crossgenfile)
            if self.coreroot is not None and not os.path.isdir(self.coreroot):
                getLogger().error('Cannot find CORE_ROOT at %s', self.coreroot)
                return

            self.traits.add_traits(overwrite=True,
                                   startupmetric=const.STARTUP_PROCESSTIME,
                                   workingdir=self.coreroot,
                                   appargs=crossgenargs)
            self.traits.add_traits(
                overwrite=False,
                scenarioname='Crossgen Throughput - %s' % self.crossgenfile,
                scenariotypename='%s - %s' %
                (const.SCENARIO_NAMES[const.CROSSGEN], self.crossgenfile),
                apptorun='%s\%s' % (self.coreroot, crossgenexe),
            )
            startup.runtests(self.traits)

        elif self.testtype == const.CROSSGEN2:
            startup = StartupWrapper()
            if self.coreroot is not None and not os.path.isdir(self.coreroot):
                getLogger().error('Cannot find CORE_ROOT at %s', self.coreroot)
                sys.exit(1)
            if bool(self.singlefile) == bool(self.compositefile):
                getLogger().error(
                    "Please specify either --single <single assembly name> or --composite <absolute path of rsp file>"
                )
                sys.exit(1)

            compiletype = const.CROSSGEN2_COMPOSITE if self.compositefile else const.CROSSGEN2_SINGLEFILE

            if compiletype == const.CROSSGEN2_SINGLEFILE:
                referencefilenames = [
                    'System.*.dll', 'Microsoft.*.dll', 'netstandard.dll',
                    'mscorlib.dll'
                ]
                referencefiles = [
                    os.path.join(self.coreroot, filename)
                    for filename in referencefilenames
                ]
                # single assembly filename: example.dll
                filename, ext = os.path.splitext(self.singlefile)
                outputdir = os.path.join(os.getcwd(), 'single.out')
                if not os.path.exists(outputdir):
                    os.mkdir(outputdir)
                outputfile = os.path.join(outputdir, filename + '.ni' + ext)
                crossgen2args = '%s -o %s -O %s' % (
                    os.path.join(self.coreroot, self.singlefile), outputfile,
                    ' -r '.join([''] + referencefiles))

            elif compiletype == const.CROSSGEN2_COMPOSITE:
                # composite rsp filename: ..\example.dll.rsp
                dllname, _ = os.path.splitext(
                    os.path.basename(self.compositefile))
                filename, ext = os.path.splitext(dllname)
                outputdir = os.path.join(os.getcwd(), 'composite.out')
                if not os.path.exists(outputdir):
                    os.mkdir(outputdir)
                outputfile = os.path.join(outputdir, filename + '.ni' + ext)
                crossgen2args = '--composite -o %s -O @%s' % (
                    outputfile, self.compositefile)
                self.traits.add_traits(overwrite=True, skipprofile='true')

            self.traits.add_traits(
                overwrite=True,
                startupmetric=const.STARTUP_CROSSGEN2,
                workingdir=self.coreroot,
                appargs='%s %s' %
                (os.path.join('crossgen2', 'crossgen2.dll'), crossgen2args))
            self.traits.add_traits(
                overwrite=False,
                scenarioname='Crossgen2 Throughput - %s - %s' %
                (compiletype, filename),
                apptorun=os.path.join(self.coreroot,
                                      'corerun%s' % extension()),
                environmentvariables='COMPlus_EnableEventLog=1'
                if not iswin() else ''  # turn on clr user events
            )
            startup.runtests(self.traits)

        elif self.testtype == const.SOD:
            sod = SODWrapper()
            builtdir = const.PUBDIR if os.path.exists(const.PUBDIR) else None
            if not builtdir:
                builtdir = const.BINDIR if os.path.exists(
                    const.BINDIR) else None
            if not (self.dirs or builtdir):
                raise Exception(
                    "Dirs was not passed in and neither %s nor %s exist" %
                    (const.PUBDIR, const.BINDIR))
            sod.runtests(scenarioname=self.scenarioname,
                         dirs=self.dirs or builtdir,
                         artifact=self.traits.artifact)
Esempio n. 4
0
    def run(self):
        '''
        Runs the specified scenario
        '''
        self.parseargs()
        if self.testtype == const.STARTUP:
            startup = StartupWrapper()
            self.traits.add_traits(
                overwrite=False,
                environmentvariables='COMPlus_EnableEventLog=1'
                if not iswin() else '',
                scenarioname=self.scenarioname,
                scenariotypename=const.SCENARIO_NAMES[const.STARTUP],
                apptorun=publishedexe(self.traits.exename),
            )
            startup.runtests(self.traits)

        elif self.testtype == const.SDK:
            startup = StartupWrapper()
            envlistbuild = 'DOTNET_MULTILEVEL_LOOKUP=0'
            envlistcleanbuild = ';'.join(
                ['MSBUILDDISABLENODEREUSE=1', envlistbuild])
            # clean build
            if self.sdktype == const.CLEAN_BUILD:
                self.traits.add_traits(
                    overwrite=False,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.CLEAN_BUILD),
                    apptorun=const.DOTNET,
                    appargs='build',
                    iterationsetup=pythoncommand(),
                    setupargs='%s %s setup_build' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    iterationcleanup=pythoncommand(),
                    cleanupargs='%s %s cleanup' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    workingdir=const.APPDIR,
                    environmentvariables=envlistcleanbuild,
                )
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

            # build(no changes)
            if self.sdktype == const.BUILD_NO_CHANGE:
                self.traits.add_traits(
                    overwrite=False,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.BUILD_NO_CHANGE),
                    apptorun=const.DOTNET,
                    appargs='build',
                    workingdir=const.APPDIR,
                    environmentvariables=envlistbuild)
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

            # new console
            if self.sdktype == const.NEW_CONSOLE:
                self.traits.add_traits(
                    overwrite=False,
                    appargs='new console',
                    apptorun=const.DOTNET,
                    scenarioname=self.scenarioname,
                    scenariotypename='%s_%s' %
                    (const.SCENARIO_NAMES[const.SDK], const.NEW_CONSOLE),
                    iterationsetup=pythoncommand(),
                    setupargs='%s %s setup_new' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    iterationcleanup=pythoncommand(),
                    cleanupargs='%s %s cleanup' %
                    ('-3' if iswin() else '', const.ITERATION_SETUP_FILE),
                    workingdir=const.APPDIR)
                self.traits.add_traits(overwrite=True,
                                       startupmetric=const.STARTUP_PROCESSTIME)
                startup.runtests(self.traits)

        elif self.testtype == const.CROSSGEN:
            startup = StartupWrapper()
            crossgenexe = 'crossgen%s' % extension()
            crossgenargs = '/nologo /p %s %s\%s' % (
                self.coreroot, self.coreroot, self.crossgenfile)
            if self.coreroot is not None and not os.path.isdir(self.coreroot):
                getLogger().error('Cannot find CORE_ROOT at %s', self.coreroot)
                return

            self.traits.add_traits(overwrite=True,
                                   startupmetric=const.STARTUP_PROCESSTIME,
                                   workingdir=self.coreroot,
                                   appargs=crossgenargs)
            self.traits.add_traits(
                overwrite=False,
                scenarioname='Crossgen Throughput - %s' % self.crossgenfile,
                scenariotypename='%s - %s' %
                (const.SCENARIO_NAMES[const.CROSSGEN], self.crossgenfile),
                apptorun='%s\%s' % (self.coreroot, crossgenexe),
            )
            startup.runtests(self.traits)

        elif self.testtype == const.SOD:
            sod = SODWrapper()
            builtdir = const.PUBDIR if os.path.exists(const.PUBDIR) else None
            if not builtdir:
                builtdir = const.BINDIR if os.path.exists(
                    const.BINDIR) else None
            if not (self.dirs or builtdir):
                raise Exception(
                    "Dirs was not passed in and neither %s nor %s exist" %
                    (const.PUBDIR, const.BINDIR))
            sod.runtests(scenarioname=self.scenarioname,
                         dirs=self.dirs or builtdir)