- job:
    name: jdk12-specjbb2015-benchmark-persist-results
    project-type: matrix
    defaults: global
    description: |
        * Writes the results to $HOME/srv/openjdk12/SPECjbb2015-nightly-runs.<br>
        * This job has the client axis <b>disabled</b> until there is enough build/test time available.<br>
          * If the client axis is enabled the heap size for the VM will need to be adjusted using -Xmxm
    properties:
        - authorization:
            everyone-flat:
                - job-read
            openjdk-members:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 10
            artifact-num-to-keep: 5
    disabled: true
    node: j12-qrep-01
    display-name: 'DELETE ME'
    axes:
        - axis:
            type: user-defined
            name: BUILD_TYPE
            values:
                - release
        - axis:
            type: slave
            name: label
            values:
                - j12-qrep-01
    execution-strategy:
        sequential: true
    wrappers:
        - workspace-cleanup:
            dirmatch: false
        - timestamps
        - matrix-tie-parent:
            node: j12-qrep-01
    builders:
        - copyartifact:
            project: jdk12-specjbb2015-benchmark
            filter: 'out/specjbb*.gz'
            target: incoming
            flatten: true
        - shell: |
            #!/bin/bash

            tree -f .

            PERSIST=$HOME/srv/openjdk12
            TOP_DIR=$PERSIST
            export SPECJBB_PRODUCT_HOME=$PERSIST/SPECjbb2015
            mkdir -p $TOP_DIR

            SCRIPT_DIR=$PERSIST/specjbb-test-scripts
            if [ -d $SCRIPT_DIR ]; then
                (cd $SCRIPT_DIR; git pull)
            else
                git clone https://git.linaro.org/leg/openjdk/specjbb-test-scripts.git $SCRIPT_DIR
            fi

            source $SCRIPT_DIR/common.sh

            # Ensure nightly results dir exists.
            mkdir -p $SPECJBB_EXPANDED_RESULTS_DIR

            echo "Previous Results"
            cat ${RESULTS_CSV}
            set -eux
            result_tarball=${WORKSPACE}/incoming/BUILD_TYPE=${BUILD_TYPE},label=${label}/specjbb-result-${BUILD_TYPE}.tar.gz
            [ -e $result_tarball ] || exit 1
            tar -C ${SPECJBB_EXPANDED_RESULTS_DIR} -xf $result_tarball
            cp incoming/BUILD_TYPE=${BUILD_TYPE},label=${label}/*.data.gz ${SPECJBB_EXPANDED_RESULTS_DIR}
            pushd ${SPECJBB_EXPANDED_RESULTS_DIR}
            echo "Updating ${RESULTS_CSV}"
            $SCRIPT_DIR/update-results-csv -- --verbose --output=${RESULTS_CSV}
