<commit_before>#!/bin/bash
. `dirname $0`/../helper_scripts/cosmic/helperlib.sh

set -e

function usage {
  printf "Usage: %s: -m marvin_config -h requires_hardware test1 test2 ... testN\n" $(basename $0) >&2
}

say "Running script: $0"

function update_management_server_in_marvin_config {
  marvin_config=$1
  csip=$2

  sed -i "s/\"mgtSvrIp\": \"localhost\"/\"mgtSvrIp\": \"${csip}\"/" ${marvin_config}

  say "Management Server in Marvin Config updated to ${csip}"
}

function run_marvin_tests {
  config_file=$1
  require_hardware=$2
  tests="$3"

  nose_tests_report_file=nosetests-required_hardware-${require_hardware}.xml

  cd cosmic-core/test/integration
  nosetests --with-xunit --xunit-file=../../../${nose_tests_report_file} --with-marvin --marvin-config=../../../${config_file} -s -a tags=advanced,required_hardware=${require_hardware} ${tests}
  cd -
}

# Options
while getopts ':m:h:' OPTION
do
  case $OPTION in
  m)    marvin_config="$OPTARG"
        ;;
  h)    require_hardware="$OPTARG"
        ;;
  esac
done

marvin_tests=${@:$OPTIND}

say "Received arguments:"
say "marvin_config = ${marvin_config}"
say "marvin_tests = \"${marvin_tests}\""

# Check if a marvin dc file was specified
if [ -z ${marvin_config} ]; then
  say "No Marvin config specified. Quiting."
  usage
  exit 1
else
  say "Using Marvin config '${marvin_config}'."
fi

if [ ! -f "${marvin_config}" ]; then
    say "Supplied Marvin config not found!"
    exit 1
fi

# Check if a marvin dc file was specified
if [ -z "${marvin_tests}" ]; then
  say "No Marvin Tests Specified. Quiting."
  usage
  exit 2
fi

parse_marvin_config ${marvin_config}

say "Making local copy of Marvin Config file"
cp ${marvin_config} .

marvin_config_copy=$(basename ${marvin_config})

say "Updating Marvin Config with Management Server IP"
update_management_server_in_marvin_config ${marvin_config_copy} ${cs1ip}

say "Running tests"
run_marvin_tests ${marvin_config_copy} ${require_hardware} "${marvin_tests}"
<commit_msg>Required hardware removed<commit_after>#!/bin/bash
. `dirname $0`/../helper_scripts/cosmic/helperlib.sh

set -e

function usage {
  printf "Usage: %s: -m marvin_config test1 test2 ... testN\n" $(basename $0) >&2
}

say "Running script: $0"

function update_management_server_in_marvin_config {
  marvin_config=$1
  csip=$2

  sed -i "s/\"mgtSvrIp\": \"localhost\"/\"mgtSvrIp\": \"${csip}\"/" ${marvin_config}

  say "Management Server in Marvin Config updated to ${csip}"
}

function run_marvin_tests {
  config_file=$1
  tests="$2"

  nose_tests_report_file=nosetests.xml

  cd cosmic-core/test/integration
  nosetests --with-xunit --xunit-file=../../../${nose_tests_report_file} --with-marvin --marvin-config=../../../${config_file} -s -a tags=advanced ${tests}
  cd -
}

# Options
while getopts ':m:' OPTION
do
  case $OPTION in
  m)    marvin_config="$OPTARG"
        ;;
  esac
done

marvin_tests=${@:$OPTIND}

say "Received arguments:"
say "marvin_config = ${marvin_config}"
say "marvin_tests = \"${marvin_tests}\""

# Check if a marvin dc file was specified
if [ -z ${marvin_config} ]; then
  say "No Marvin config specified. Quiting."
  usage
  exit 1
else
  say "Using Marvin config '${marvin_config}'."
fi

if [ ! -f "${marvin_config}" ]; then
    say "Supplied Marvin config not found!"
    exit 1
fi

# Check if a marvin dc file was specified
if [ -z "${marvin_tests}" ]; then
  say "No Marvin Tests Specified. Quiting."
  usage
  exit 2
fi

parse_marvin_config ${marvin_config}

say "Making local copy of Marvin Config file"
cp ${marvin_config} .

marvin_config_copy=$(basename ${marvin_config})

say "Updating Marvin Config with Management Server IP"
update_management_server_in_marvin_config ${marvin_config_copy} ${cs1ip}

say "Running tests"
run_marvin_tests ${marvin_config_copy} "${marvin_tests}"

{'fraction_non_alphanumeric': 0.14296977660972404, 'fraction_numerical': 0.007621550591327201, 'mean_word_length': 4.157181571815718, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3482815', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1344, 'n_words': 358}