<commit_before>#!/usr/bin/env bash

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

set -o errexit
set -o nounset
set -o pipefail

TP5N_SOURCE="https://github.com/rwood-moz/talos-pagesets/raw/master/tp5n.zip"
TP5N_PATH="page_load_test/tp5n.zip"

if [[ ! -f "$(dirname "${TP5N_PATH}")/tp5n/tp5n.manifest" ]]; then
    if [[ ! -f "${TP5N_PATH}" ]]; then
        echo "Downloading the test cases..."
        wget "${TP5N_SOURCE}" -O "${TP5N_PATH}"
        echo "done"
    else
        echo "Found existing test cases, skipping download."
    fi
    echo -n "Unzipping the test cases..."
    unzip -q -o "${TP5N_PATH}" -d "$(dirname "${TP5N_PATH}")"
    echo "done"
else
    echo "Found existing test cases, skipping download and unzip."
fi

# We use the https URL for the repo so the clone works even if
# github.com isn't in ssh's known hosts.
WARC_DIR="./servo-warc-tests"
WARC_REPO="https://github.com/servo/servo-warc-tests.git"

# Clone the warc tests if they don't exist
if [[ ! -d ${WARC_DIR} ]]; then
    git clone --progress ${WARC_REPO}
fi

# Make sure we're running with an up-to-date warc test repo
git -C ${WARC_DIR} pull --progress

virtualenv venv --python="$(which python3)"
PS1="" source venv/bin/activate
# `PS1` must be defined before activating virtualenv
pip install \
    "boto3>=1.4.0" \
    git+https://github.com/ikreymer/pywb.git

mkdir -p servo
mkdir -p output # Test result will be saved to output/perf-<timestamp>.json
./git_log_to_json.sh > servo/revision.json<commit_msg>Use an explicit virtualenv name when running perf tests.<commit_after>#!/usr/bin/env bash

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

set -o errexit
set -o nounset
set -o pipefail

TP5N_SOURCE="https://github.com/rwood-moz/talos-pagesets/raw/master/tp5n.zip"
TP5N_PATH="page_load_test/tp5n.zip"

if [[ ! -f "$(dirname "${TP5N_PATH}")/tp5n/tp5n.manifest" ]]; then
    if [[ ! -f "${TP5N_PATH}" ]]; then
        echo "Downloading the test cases..."
        wget "${TP5N_SOURCE}" -O "${TP5N_PATH}"
        echo "done"
    else
        echo "Found existing test cases, skipping download."
    fi
    echo -n "Unzipping the test cases..."
    unzip -q -o "${TP5N_PATH}" -d "$(dirname "${TP5N_PATH}")"
    echo "done"
else
    echo "Found existing test cases, skipping download and unzip."
fi

# We use the https URL for the repo so the clone works even if
# github.com isn't in ssh's known hosts.
WARC_DIR="./servo-warc-tests"
WARC_REPO="https://github.com/servo/servo-warc-tests.git"

# Clone the warc tests if they don't exist
if [[ ! -d ${WARC_DIR} ]]; then
    git clone --progress ${WARC_REPO}
fi

# Make sure we're running with an up-to-date warc test repo
git -C ${WARC_DIR} pull --progress

virtualenv venv ./perf-venv --python="$(which python3)"
PS1="" source ./perf-venv/bin/activate
# `PS1` must be defined before activating virtualenv
pip install \
    "boto3>=1.4.0" \
    git+https://github.com/ikreymer/pywb.git

mkdir -p servo
mkdir -p output # Test result will be saved to output/perf-<timestamp>.json
./git_log_to_json.sh > servo/revision.json
{'fraction_non_alphanumeric': 0.13882282996432818, 'fraction_numerical': 0.013674197384066587, 'mean_word_length': 3.286624203821656, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6177848', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1177, 'n_words': 386}