Skip to content

Commit

Permalink
Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung committed Mar 28, 2024
1 parent 7f832e6 commit b383841
Show file tree
Hide file tree
Showing 42 changed files with 983 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CoreLab/.lldbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
breakpoint set -r EnsureEEStarted
run
breakpoint set -r .*andrew_debug
9 changes: 9 additions & 0 deletions CoreLab/CoreLab.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

</Project>
17 changes: 17 additions & 0 deletions CoreLab/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Reflection;
using System.Diagnostics;

namespace CoreLab
{
internal static class Program
{
private static void Main()
{
Console.WriteLine("Andrew wins");
}
}
}
6 changes: 6 additions & 0 deletions CoreLab/autodbg.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.load C:\dev\diagnostics\artifacts\bin\Windows_NT.x64.Debug\sos.dll
sxe ld coreclr
g
!do 0
bm coreclr!*andrew_debug*
.echo Game On
13 changes: 13 additions & 0 deletions m.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@echo off

setlocal
if "%ANDREW_OPTIMIZED%"=="1" (
REM build.cmd -rc release -lc release -arch x64 -vs coreclr.sln
set ANDREW_ARCH_PART=artifacts\obj\coreclr\windows.x64.Release\ide\vm\wks\cee_wks_core.vcxproj
) else (
REM build.cmd -rc debug -lc release -arch x64 -vs coreclr.sln
set ANDREW_ARCH_PART=artifacts\obj\coreclr\windows.x64.Debug\ide\vm\wks\cee_wks_core.vcxproj
)
msbuild %ANDREW_ARCH_PART%
endlocal

3 changes: 3 additions & 0 deletions p.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
cd %~dp0
powershell -NoExit -Command ". ./scripts/init.ps1"
4 changes: 4 additions & 0 deletions p.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cd `dirname "${BASH_SOURCE[0]}"`
pwsh -NoExit -Command ". ./scripts/init.ps1"
13 changes: 13 additions & 0 deletions scripts/alert.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Param (
[string]$msg
)

. (Join-Path $PSScriptRoot "common.ps1")

if (-not($msg))
{
Write-Output "The msg parameter is required"
Exit
}

Invoke-Expression "$($alert) `"$($msg)`""
63 changes: 63 additions & 0 deletions scripts/build-clrgc.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
. (Join-Path $PSScriptRoot "common.ps1")



switch($mode)
{
"debug" { $mode_part = "Debug" }
"checked" { $mode_part = "Checked" }
"release" { $mode_part = "Release" }
Default { $mode_part = "Debug" }
}

switch($arch)
{
"x86" { $arch_part = "x86"; $arch_part_2 = "x86" }
"x64" { $arch_part = "x64"; $arch_part_2 = "amd64" }
Default { $arch_part = "x64"; $arch_part_2 = "amd64" }
}

$exp = $env:andrew_exp

if ($exp -eq "0")
{
$clrgc_favor="clrgc"
}
else
{
$clrgc_favor="clrgcexp"
}

switch($os)
{
"windows"
{
$prefix = "cmd /c '`"$($vspath)`" -arch=$($arch_part_2) -host_arch=$($arch_part_2) & "
$postfix = "'"
$target = "$($clrgc_favor).dll"
$filename = "$($clrgc_favor).dll"
}
"linux"
{
$prefix = ""
$postfix = ""
$target = "$($clrgc_favor)"
$filename = "lib$($clrgc_favor).so"
}
"osx"
{
$prefix = ""
$postfix = ""
$target = "$($clrgc_favor)"
$filename = "lib$($clrgc_favor).dylib"
}
}

$build_command = $prefix + (path "cmake --build artifacts\obj\coreclr\$($os).$($arch_part).$($mode_part) --target $($target) --config $($mode_part) $($postfix)")
$src = path "artifacts\obj\coreclr\$($os).$($arch_part).$($mode_part)\gc\$($filename)"
$dst = path "artifacts\bin\coreclr\$($os).$($arch_part).$($mode_part)\"

pushd $repo_root
Invoke-Expression $build_command
copy $src $dst -force
popd
22 changes: 22 additions & 0 deletions scripts/build-coreclr.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
. (Join-Path $PSScriptRoot "common.ps1")

switch($mode)
{
"debug" { $mode_part = "" }
"checked" { $mode_part = "-c checked" }
"release" { $mode_part = "-c release" }
Default { $mode_part = "" }
}

switch($arch)
{
"x86" { $arch_part = "-a x86" }
"x64" { $arch_part = "" }
Default { $arch_part = "" }
}

$build_command = ".\build$($script_suffix) -s clr $($mode_part) $($arch_part)"

pushd $repo_root
Invoke-Expression $build_command
popd
27 changes: 27 additions & 0 deletions scripts/build-corelab.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
. (Join-Path $PSScriptRoot "common.ps1")

switch($mode)
{
"debug" { $build_mode_part = "" ; $bin_mode_part = "Debug" }
"checked" { $build_mode_part = "-c Checked" ; $bin_mode_part = "Checked" }
"release" { $build_mode_part = "-c Release" ; $bin_mode_part = "Release" }
Default { $build_mode_part = "" ; $bin_mode_part = "Debug" }
}

switch($arch)
{
"x86" { $arch_part = "x86" }
"x64" { $arch_part = "x64" }
Default { $arch_part = "x64" }
}

$script_path = path "$($PSScriptRoot)\..\CoreLab"
$build_command = path "$($repo_root)\dotnet$($script_suffix) publish --self-contained -r $($rid) $($build_mode_part)"
$coreclr_binary_path = path "$($PSScriptRoot)\..\artifacts\bin\coreclr\$($os).$($arch_part).$($bin_mode_part)\*"
$corelab_binary_path = path "$($PSScriptRoot)\..\artifacts\bin\CoreLab\$($bin_mode_part)\net7.0\$($rid)\publish"

pushd $script_path
Write-Output $build_command
Invoke-Expression $build_command
copy $coreclr_binary_path $corelab_binary_path -recurse -force
popd
23 changes: 23 additions & 0 deletions scripts/build-coreroot.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
. (Join-Path $PSScriptRoot "common.ps1")

switch($mode)
{
"debug" { $mode_part = "" }
"checked" { $mode_part = "checked" }
"release" { $mode_part = "release" }
Default { $mode_part = "" }
}

switch($arch)
{
"x86" { $arch_part = "x86" }
"x64" { $arch_part = "" }
Default { $arch_part = "" }
}

$script_path = path "$($PSScriptRoot)\..\src\tests"
$build_command = "./build$($script_suffix) generatelayoutonly $($mode_part) $($arch_part)"

pushd $script_path
Invoke-Expression $build_command
popd
50 changes: 50 additions & 0 deletions scripts/build-gcsample.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
. (Join-Path $PSScriptRoot "common.ps1")

switch($mode)
{
"debug" { $mode_part = "Debug" }
"checked" { $mode_part = "Checked" }
"release" { $mode_part = "Release" }
Default { $mode_part = "Debug" }
}

switch($arch)
{
"x86" { $arch_part = "x86"; $arch_part_2 = "x86" }
"x64" { $arch_part = "x64"; $arch_part_2 = "amd64" }
Default { $arch_part = "x64"; $arch_part_2 = "amd64" }
}

switch($os)
{
"windows"
{
$prefix = "cmd /c '`"$($vspath)`" -arch=$($arch_part_2) -host_arch=$($arch_part_2) & "
$postfix = "'"
$target = "gcsample"
$filename = "gcsample.exe"
}
"linux"
{
$prefix = ""
$postfix = ""
$target = "gcsample"
$filename = "gcsample"
}
"osx"
{
$prefix = ""
$postfix = ""
$target = "gcsample"
$filename = "gcsample"
}
}

$build_command = $prefix + (path "cmake --build artifacts\obj\coreclr\$($os).$($arch_part).$($mode_part) --target $($target) --config $($mode_part) $($postfix)")
$src = path "artifacts\obj\coreclr\$($os).$($arch_part).$($mode_part)\gc\sample\$($filename)"
$dst = path "artifacts\bin\coreclr\$($os).$($arch_part).$($mode_part)\"

pushd $repo_root
Invoke-Expression $build_command
copy $src $dst -force
popd
22 changes: 22 additions & 0 deletions scripts/build-library.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
. (Join-Path $PSScriptRoot "common.ps1")

switch($mode)
{
"debug" { $mode_part = "" }
"checked" { $mode_part = "/p:RuntimeConfiguration=Checked" }
"release" { $mode_part = "/p:RuntimeConfiguration=Release" }
Default { $mode_part = "" }
}

switch($arch)
{
"x86" { $arch_part = "-a x86" }
"x64" { $arch_part = "" }
Default { $arch_part = "" }
}

$build_command = path ".\build$($script_suffix) -c release -s libs $($mode_part) $($arch_part)"

pushd $repo_root
Invoke-Expression $build_command
popd
24 changes: 24 additions & 0 deletions scripts/build-test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
. (Join-Path $PSScriptRoot "common.ps1")

switch($mode)
{
"debug" { $build_mode_part = "" ; }
"checked" { $build_mode_part = "-c Checked" ; }
"release" { $build_mode_part = "-c Release" ; }
Default { $build_mode_part = "" ; }
}

switch($arch)
{
"x86" { $arch_part = "x86" }
"x64" { $arch_part = "x64" }
Default { $arch_part = "x64" }
}

$script_path = path "$($PSScriptRoot)\..\src\tests\$($test_source_path)"
$build_command = path "$($repo_root)\dotnet$($script_suffix) build /p:TargetArchitecture=$($arch_part) $($build_mode_part) $($test_proj_name).csproj"

pushd $script_path
Write-Output $build_command
Invoke-Expression $build_command
popd
67 changes: 67 additions & 0 deletions scripts/common.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
$mode = $env:andrew_mode
$arch = $env:andrew_arch
$repo_root = Join-Path $PSScriptRoot ".."

if ($IsWindows -or $ENV:OS)
{
$os = "windows"
$sep = "\"
$script_suffix = ".cmd"
$rid_os_part = "win"
$powershell_cmd = "powershell"
$alert = "c:\toolssw\slack\alert"
$gcperfsim_path = "C:\Dev\performance\artifacts\bin\GCPerfSim\Release\net7.0"
}
else
{
if ($IsLinux)
{
$os = "linux"
$rid_os_part = "linux"
}
else
{
$os = "osx"
$rid_os_part = "osx"
}
$sep = "/"
$script_suffix = ".sh"
$powershell_cmd = "pwsh"
$alert = "python3 $($home)/toolssw/alert.py"
$gcperfsim_path = "$($home)/git/performance/artifacts/bin/GCPerfSim/Release/net7.0"
}

switch($arch)
{
"x86" { $rid = $rid_os_part + "-x86" }
"x64" { $rid = $rid_os_part + "-x64" }
Default { $rid = $rid_os_part + "-x64" }
}

function path([string] $s)
{
return $s.replace("\", $sep)
}

# Configuration for build/run/debug test
$test_source_path = "GC/API/GC"
$test_proj_name = "Collect_Aggressive"

# Configuration for GCPerfSim
$gcperfsim_args = "-tc 6 -tagb 100.0 -tlgb 0.01 -lohar 0 -pohar 0 -sohsi 10 -lohsi 0 -pohsi 0 -sohsr 100-4000 -lohsr 102400-204800 -pohsr 100-4000 -sohpi 10 -lohpi 0 -sohfi 0 -lohfi 0 -pohfi 0 -allocType reference -testKind time"

if ([System.Net.Dns]::GetHostName() -eq "ANDREWAU-LHS20")
{
$vspath = "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat"
}
else
{
if ([System.Net.Dns]::GetHostName() -eq "CPC-andre-7ZK5S")
{
$vspath = "C:\Program Files\Microsoft Visual Studio\2022\IntPreview\Common7\Tools\VsDevCmd.bat"
}
else
{
$vspath = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
}
}
Loading

0 comments on commit b383841

Please sign in to comment.