summaryrefslogtreecommitdiff
path: root/tests/scripts/perf-prep.sh
blob: 698886e2c1195567d6116182411cefb8407d003e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash

function print_usage {
    echo ''
    echo 'CoreCLR perf test environment set up script on Linux.'
    echo ''
    echo 'Typical command line:'
    echo ''
    echo 'coreclr/tests/scripts/perf-perp.sh'
    echo '    --branch="dotnet_coreclr"'
    echo ''
    echo 'Required arguments:'
    echo '  --branch=<path>             : branch where coreclr/corefx/test bits are copied from (e.g. dotnet_coreclr).'
}

# Exit code constants
readonly EXIT_CODE_SUCCESS=0       # Script ran normally.

# Argument variables
perfArch="x64"
perfConfig="Release"
perfBranch=

for i in "$@"
do
    case $i in
        -h|--help)
            print_usage
            exit $EXIT_CODE_SUCCESS
            ;;
        --branch=*)
            perfBranch=${i#*=}
            ;;
        *)
            echo "Unknown switch: $i"
            print_usage
            exit $EXIT_CODE_SUCCESS
            ;;
    esac
done

perfBranch="dotnet_coreclr"
echo "branch = $perfBranch"
echo "architecture = $perfArch"
echo "configuration = $perfConfig"

# Install nuget to download benchview package, which includes the script machinedata.py for machine data collection
wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
chmod u+x ./nuget.exe
./nuget.exe install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory ./tests/scripts -Prerelease -ExcludeVersion

# Install python 3.5.2 to run machinedata.py for machine data collection
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get --assume-yes install python3.5
python3.5 --version
python3.5 ./tests/scripts/Microsoft.BenchView.JSONFormat/tools/machinedata.py

# Set up the copies
# Coreclr build containing the tests and mscorlib
curl http://dotnet-ci.cloudapp.net/job/$perfBranch/job/master/job/release_windows_nt/lastSuccessfulBuild/artifact/bin/tests/tests.zip -o tests.zip

# Coreclr build we are trying to test
curl http://dotnet-ci.cloudapp.net/job/$perfBranch/job/master/job/release_ubuntu/lastSuccessfulBuild/artifact/*zip*/archive.zip -o bin.zip

# Corefx components.  We now have full stack builds on all distros we test here, so we can copy straight from CoreFX jobs.
curl http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/master/job/ubuntu14.04_release/lastSuccessfulBuild/artifact/bin/build.tar.gz -o build.tar.gz

# Unpack the corefx binaries
tar -xf build.tar.gz

# Unzip the coreclr binaries
unzip -q -o bin.zip

# Copy coreclr binaries to the right dir
cp -R ./archive/bin/obj ./bin
cp -R ./archive/bin/Product ./bin

# Unzip the tests first.  Exit with 0
mkdir ./bin/tests
unzip -q -o tests.zip -d ./bin/tests/Windows_NT.$perfArch.$perfConfig || exit 0
echo "unzip tests to ./bin/tests/Windows_NT.$perfArch.$perfConfig"