<commit_before># Suite of verification tests for the SINGLE TensorFlow wheel in /tf/pkg
# or whatever path is set as $TF_WHEEL.

setup_file() {
    cd /tf/pkg
    if [[ -z "$TF_WHEEL" ]]; then
        export TF_WHEEL=$(find /tf/pkg -iname "*.whl")
    fi
}

teardown_file() {
    rm -rf /tf/venv
}

@test "Wheel is manylinux2014 (manylinux_2_17) compliant" {
    python3 -m auditwheel show "$TF_WHEEL" > audit.txt
    grep --quiet 'This constrains the platform tag to "manylinux_2_17_x86_64"' audit.txt
}

@test "Wheel conforms to upstream size limitations" {
    WHEEL_MEGABYTES=$(stat --format %s "$TF_WHEEL" | awk '{print int($1/(1024*1024))}')
    # Ref. cs/test_tf_whl_size (internal only)
    case "$TF_WHEEL" in
        # CPU:
        *cpu*manylinux*) LARGEST_OK_SIZE=220 ;;
        *cpu*win*)       LARGEST_OK_SIZE=170 ;;
        *macos*)         LARGEST_OK_SIZE=225 ;;
        # GPU:
        *manylinux*)     LARGEST_OK_SIZE=560 ;;
        *win*)           LARGEST_OK_SIZE=345 ;;
        # Unknown:
        *)
            echo "The wheel's name is in an unknown format."
            exit 1
            ;;
    esac
    # >&3 forces output in bats even if the test passes. See
    # https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal
    echo "# Size of $TF_WHEEL is $WHEEL_MEGABYTES / $LARGEST_OK_SIZE megabytes." >&3<commit_msg>Raises TensorFlow Linux GPU package size limit<commit_after># Suite of verification tests for the SINGLE TensorFlow wheel in /tf/pkg
# or whatever path is set as $TF_WHEEL.

setup_file() {
    cd /tf/pkg
    if [[ -z "$TF_WHEEL" ]]; then
        export TF_WHEEL=$(find /tf/pkg -iname "*.whl")
    fi
}

teardown_file() {
    rm -rf /tf/venv
}

@test "Wheel is manylinux2014 (manylinux_2_17) compliant" {
    python3 -m auditwheel show "$TF_WHEEL" > audit.txt
    grep --quiet 'This constrains the platform tag to "manylinux_2_17_x86_64"' audit.txt
}

@test "Wheel conforms to upstream size limitations" {
    WHEEL_MEGABYTES=$(stat --format %s "$TF_WHEEL" | awk '{print int($1/(1024*1024))}')
    # Ref. cs/test_tf_whl_size (internal only)
    case "$TF_WHEEL" in
        # CPU:
        *cpu*manylinux*) LARGEST_OK_SIZE=220 ;;
        *cpu*win*)       LARGEST_OK_SIZE=170 ;;
        *macos*)         LARGEST_OK_SIZE=225 ;;
        # GPU:
        *manylinux*)     LARGEST_OK_SIZE=580 ;;
        *win*)           LARGEST_OK_SIZE=345 ;;
        # Unknown:
        *)
            echo "The wheel's name is in an unknown format."
            exit 1
            ;;
    esac
    # >&3 forces output in bats even if the test passes. See
    # https://bats-core.readthedocs.io/en/stable/writing-tests.html#printing-to-the-terminal
    echo "# Size of $TF_WHEEL is $WHEEL_MEGABYTES / $LARGEST_OK_SIZE megabytes." >&3
{'fraction_non_alphanumeric': 0.12378553436487945, 'fraction_numerical': 0.030226700251889168, 'mean_word_length': 2.523447401774398, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2276055', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1020, 'n_words': 255}