<commit_before>void build(String CMAKE_BUILD_TYPE) {
    popArtifactFile("${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz")
    sh """
        TARBALL=\$(pwd -P)/${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz
        if [ -f "\${TARBALL}" -a '${FORCE_REBUILD}' = 'false' ]; then
            echo Skip building
            mkdir -p ${CMAKE_BUILD_TYPE}/destdir/usr/local
            tar \
                -C ${CMAKE_BUILD_TYPE}/destdir/usr/local \
                -xzf \${TARBALL}
        else
            mkdir ${CMAKE_BUILD_TYPE} || :
            pushd ${CMAKE_BUILD_TYPE}
                export WITH_ZSTD=\$(pwd -P)/../zstd-1.1.3/lib
                cmake .. \
                    -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
                    -DWITH_SSL=system \
                    -DWITH_ZLIB=bundled \
                    -DMYSQL_MAINTAINER_MODE=0 \
                    -DENABLED_LOCAL_INFILE=1 \
                    -DENABLE_DTRACE=0 \
                    -DCMAKE_CXX_FLAGS='-march=native' \
                    -DCMAKE_INSTALL_PREFIX="/usr/local/${GIT_BRANCH}" \
                    -DMYSQL_DATADIR="/usr/local/${GIT_BRANCH}/data"
                make -j8

                export DESTDIR=destdir
                make install

                mkdir -p destdir/usr/local/${GIT_BRANCH}/rqg/rqg/common/
                cp -r \
                    ../rqg/rqg/common/mariadb-patches \
                    destdir/usr/local/${GIT_BRANCH}/rqg/rqg/common/mariadb-patches

                tar \
                    -C destdir/usr/local \
                    --owner=0 \
                    --group=0 \
                    -czf \${TARBALL} \
                    ${GIT_BRANCH}
            popd
        fi
    """
    archiveArtifacts "${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz"
    pushArtifactFile("${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz")
}

void runMTR(String CMAKE_BUILD_TYPE) {
    popArtifactFile("mtr-${CMAKE_BUILD_TYPE}.log")
    popArtifactFile("junit-${CMAKE_BUILD_TYPE}.xml")
    sh """
        ROOT_DIR=\$(pwd -P)
        if [ -f 'junit-${CMAKE_BUILD_TYPE}.xml' -a '${FORCE_RETEST}' = 'false' ]; then
            echo Skip mtr
        else
            pushd ${CMAKE_BUILD_TYPE}/destdir/usr/local/${GIT_BRANCH}/mysql-test
                export LD_PRELOAD=\$(
                    ls /usr/local/lib/libeatmydata.so \
                        /usr/lib64/libeatmydata.so \
                        /usr/lib/libeatmydata.so \
                        /usr/lib/libeatmydata/libeatmydata.so \
                        2>/dev/null \
                        | tail -1
                )
                perl mysql-test-run.pl \
                    --async-client \
                    --parallel=\$(grep -cw ^processor /proc/cpuinfo) \<commit_msg>BLD-766 add zstd library path<commit_after>void build(String CMAKE_BUILD_TYPE) {
    popArtifactFile("${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz")
    sh """
        TARBALL=\$(pwd -P)/${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz
        if [ -f "\${TARBALL}" -a '${FORCE_REBUILD}' = 'false' ]; then
            echo Skip building
            mkdir -p ${CMAKE_BUILD_TYPE}/destdir/usr/local
            tar \
                -C ${CMAKE_BUILD_TYPE}/destdir/usr/local \
                -xzf \${TARBALL}
        else
            mkdir ${CMAKE_BUILD_TYPE} || :
            pushd ${CMAKE_BUILD_TYPE}
                export WITH_ZSTD=\$(pwd -P)/../zstd-1.1.3/lib
                cmake .. \
                    -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
                    -DWITH_SSL=system \
                    -DWITH_ZLIB=bundled \
                    -DMYSQL_MAINTAINER_MODE=0 \
                    -DENABLED_LOCAL_INFILE=1 \
                    -DENABLE_DTRACE=0 \
                    -DCMAKE_CXX_FLAGS='-march=native' \
                    -DCMAKE_INSTALL_PREFIX="/usr/local/${GIT_BRANCH}" \
                    -DMYSQL_DATADIR="/usr/local/${GIT_BRANCH}/data"
                make -j8

                export DESTDIR=destdir
                make install

                mkdir -p destdir/usr/local/${GIT_BRANCH}/rqg/rqg/common/
                cp -r \
                    ../rqg/rqg/common/mariadb-patches \
                    destdir/usr/local/${GIT_BRANCH}/rqg/rqg/common/mariadb-patches

                tar \
                    -C destdir/usr/local \
                    --owner=0 \
                    --group=0 \
                    -czf \${TARBALL} \
                    ${GIT_BRANCH}
            popd
        fi
    """
    archiveArtifacts "${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz"
    pushArtifactFile("${GIT_BRANCH}-${CMAKE_BUILD_TYPE}.tar.gz")
}

void runMTR(String CMAKE_BUILD_TYPE) {
    popArtifactFile("mtr-${CMAKE_BUILD_TYPE}.log")
    popArtifactFile("junit-${CMAKE_BUILD_TYPE}.xml")
    sh """
        ROOT_DIR=\$(pwd -P)
        if [ -f 'junit-${CMAKE_BUILD_TYPE}.xml' -a '${FORCE_RETEST}' = 'false' ]; then
            echo Skip mtr
        else
            export LD_LIBRARY_PATH=\$(pwd -P)/zstd-1.1.3/lib
            pushd ${CMAKE_BUILD_TYPE}/destdir/usr/local/${GIT_BRANCH}/mysql-test
                export LD_PRELOAD=\$(
                    ls /usr/local/lib/libeatmydata.so \
                        /usr/lib64/libeatmydata.so \
                        /usr/lib/libeatmydata.so \
                        /usr/lib/libeatmydata/libeatmydata.so \
                        2>/dev/null \
                        | tail -1
                )
                perl mysql-test-run.pl \
                    --async-client \
                    --parallel=\$(grep -cw ^processor /proc/cpuinfo) \
{'fraction_non_alphanumeric': 0.1298607343100018, 'fraction_numerical': 0.0057876650388858746, 'mean_word_length': 1.2553017944535074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '87716', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1776, 'n_words': 221}