<commit_before>#!/bin/bash

# Use "bin/test.sh local test [testname]"" to run only one specific test
# Example: "bin/test.sh local test jplStartTest"

# Functions
function runWithinDocker () {
    command=$1
    docker exec ${id} bash -c "${command}"
    returnValue=$((returnValue + $?))
}

function runTest () {
    testName=$1
    echo "# Run ${testName} Test..."
    if [[ "$2" == "" ]]
    then
        expectedResult=0
    else
        expectedResult=$2
    fi
    if [[ "$uniqueTestName" != "" ]] && [[ "$uniqueTestName" != "$testName" ]]
    then
        echo -e "\t\t(Mock)"
        return 0
    fi
    docker exec ${id} bash -c "java -jar jenkins-cli.jar -s http://localhost:8080 build ${testName} --username redpanda --password <PASSWORD> -s"
    if [[ "$?" -ne "${expectedResult}" ]]
    then
        returnValue=$((returnValue + 1))
    fi
    docker cp ${id}:/root/.jenkins/jobs/${testName}/builds/1/log test/reports/${testName}.log
    returnValue=$((returnValue + $?))
}

# Configuration
cd $(dirname "$0")/..
mkdir -p test/reports
rm -f test/reports/*
returnValue=0
doTests="false"
testName=""
uniqueTestName=""
if [[ "$1" == "local" ]]
then
    if [[ "$2" == "test" ]]
    then<commit_msg>Build: Restrict ammount of memory used in the testsç<commit_after>#!/bin/bash

# Use "bin/test.sh local test [testname]"" to run only one specific test
# Example: "bin/test.sh local test jplStartTest"

# Functions
function runWithinDocker () {
    command=$1
    docker exec ${id} bash -c "${command}"
    returnValue=$((returnValue + $?))
}

function runTest () {
    testName=$1
    echo "# Run ${testName} Test..."
    if [[ "$2" == "" ]]
    then
        expectedResult=0
    else
        expectedResult=$2
    fi
    if [[ "$uniqueTestName" != "" ]] && [[ "$uniqueTestName" != "$testName" ]]
    then
        echo -e "\t\t(Mock)"
        return 0
    fi
    docker exec ${id} bash -c "java -Xmx512m -jar jenkins-cli.jar -s http://localhost:8080 build ${testName} --username redpanda --password <PASSWORD> -s"
    if [[ "$?" -ne "${expectedResult}" ]]
    then
        returnValue=$((returnValue + 1))
    fi
    docker cp ${id}:/root/.jenkins/jobs/${testName}/builds/1/log test/reports/${testName}.log
    returnValue=$((returnValue + $?))
}

# Configuration
cd $(dirname "$0")/..
mkdir -p test/reports
rm -f test/reports/*
returnValue=0
doTests="false"
testName=""
uniqueTestName=""
if [[ "$1" == "local" ]]
then
    if [[ "$2" == "test" ]]
    then
{'fraction_non_alphanumeric': 0.1876523151909017, 'fraction_numerical': 0.01421608448415922, 'mean_word_length': 2.9157392686804453, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '284848', 'n_tokens_mistral': 866, 'n_tokens_neox': 829, 'n_words': 216}