<commit_before>#!/bin/bash -eu
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

# Workaround for distutils, which doesn't copy $CC except on OSX.
export LDSHARED="$CC -shared"
# Workaround for PGen, which doesn't use CFLAGS for linking
export LDFLAGS="$CFLAGS"
# _freeze_importlib, and presumably all other binaries (including the fuzzer),
# trip the leak detection.
export ASAN_OPTIONS="detect_leaks=0"

# Build python to run the app.
pushd cpython
./configure --prefix=$OUT/ --with-ensurepip=no
make -j$(nproc) install
popd

FUZZ_DIR=cpython/Modules/_fuzz
for fuzz_test in $(cat $FUZZ_DIR/fuzz_tests.txt)
do
  $CC $CFLAGS \
    -D _Py_FUZZ_ONE -D _Py_FUZZ_$fuzz_test \
    -Wno-unused-function \
    $($OUT/bin/python3-config --cflags) -c -g -O1 \
    $FUZZ_DIR/fuzzer.c -o $fuzz_test.o
  $CXX $CXXFLAGS \
    $fuzz_test.o \
    -o $OUT/$fuzz_test \
    -lFuzzingEngine \
    $($OUT/bin/python3-config --ldflags)
done
<commit_msg>Use updated naming scheme for cpython's fuzz tests, as it was merged.<commit_after>#!/bin/bash -eu
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

# Workaround for distutils, which doesn't copy $CC except on OSX.
export LDSHARED="$CC -shared"
# Workaround for PGen, which doesn't use CFLAGS for linking
export LDFLAGS="$CFLAGS"
# _freeze_importlib, and presumably all other binaries (including the fuzzer),
# trip the leak detection.
export ASAN_OPTIONS="detect_leaks=0"

# Build python to run the app.
pushd cpython
./configure --prefix=$OUT/ --with-ensurepip=no
make -j$(nproc) install
popd

FUZZ_DIR=cpython/Modules/_xxtestfuzz
for fuzz_test in $(cat $FUZZ_DIR/fuzz_tests.txt)
do
  $CC $CFLAGS \
    -D _Py_FUZZ_ONE -D _Py_FUZZ_$fuzz_test \
    -Wno-unused-function \
    $($OUT/bin/python3-config --cflags) -c -g -O1 \
    $FUZZ_DIR/fuzzer.c -o $fuzz_test.o
  $CXX $CXXFLAGS \
    $fuzz_test.o \
    -o $OUT/$fuzz_test \
    -lFuzzingEngine \
    $($OUT/bin/python3-config --ldflags)
done

{'fraction_non_alphanumeric': 0.14898348157560357, 'fraction_numerical': 0.007623888182973317, 'mean_word_length': 4.006359300476947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '487023', 'n_tokens_mistral': 1035, 'n_tokens_neox': 990, 'n_words': 349}