<commit_before>#!/bin/bash

# runs all JUnit tests in the subpackage 'org.xtreemfs.test' that end with '*Test.java'

TEST_DIR=$4
if [ -z $TEST_DIR ]
then
  TEST_DIR=/tmp/xtreemfs-junit
  if [ ! -d "$TEST_DIR" ]; then mkdir "$TEST_DIR"; fi
  if [ ! -d "${TEST_DIR}/log" ]; then mkdir "${TEST_DIR}/log"; fi
fi
echo "TEST_DIR: $TEST_DIR"

JUNIT_LOG_FILE="${TEST_DIR}/log/junit.log"

XTREEMFS=$1
if [ -z "$XTREEMFS" ]
then
  # Try to guess the XtreemFS svn root.
  if [ -d "java/servers" ]; then XTREEMFS="."; fi
fi
echo "XTREEMFS=$XTREEMFS"

# Method which returns a regex list of possible ports in use by the server webinterfaces.
function get_webinterface_ports() {
  offset=$(grep "PORT_RANGE_OFFSET = " "${XTREEMFS}/java/servers/test/org/xtreemfs/test/SetupUtils.java" | grep -oE "[0-9]+")
  
  default_ports="30638 30636 30639 29637 29640 29641 29642"
  for port in $default_ports
  do
    default_ports=${default_ports/$port/$(($port + $offset))}
  done
  
  # Construct final regex:
  echo ":("${default_ports// /|}")"
}

# The used Sun webserver does allow to set the socket option SO_REUSEADDR.
# Therefore, a subsequent JUnit test may fail with "address already in use"
# because the webinterface of an XtreemFS server from a previous test is still
# in the TIME_WAIT state
function wait_for_time_wait_ports() {
  ports_regex=$(get_webinterface_ports)
  <commit_msg>tests: JUnit system test: Added regular ports to the list of ports to wait for before starting the next test.<commit_after>#!/bin/bash

# runs all JUnit tests in the subpackage 'org.xtreemfs.test' that end with '*Test.java'

TEST_DIR=$4
if [ -z $TEST_DIR ]
then
  TEST_DIR=/tmp/xtreemfs-junit
  if [ ! -d "$TEST_DIR" ]; then mkdir "$TEST_DIR"; fi
  if [ ! -d "${TEST_DIR}/log" ]; then mkdir "${TEST_DIR}/log"; fi
fi
echo "TEST_DIR: $TEST_DIR"

JUNIT_LOG_FILE="${TEST_DIR}/log/junit.log"

XTREEMFS=$1
if [ -z "$XTREEMFS" ]
then
  # Try to guess the XtreemFS svn root.
  if [ -d "java/servers" ]; then XTREEMFS="."; fi
fi
echo "XTREEMFS=$XTREEMFS"

# Method which returns a regex list of possible ports in use by the server webinterfaces.
function get_webinterface_ports() {
  offset=$(grep "PORT_RANGE_OFFSET = " "${XTREEMFS}/java/servers/test/org/xtreemfs/test/SetupUtils.java" | grep -oE "[0-9]+")
  
  default_ports="30638 30636 30639 29637 29640 29641 29642 32638 32636 32639 32637 32640 32641 32642"
  for port in $default_ports
  do
    default_ports=${default_ports/$port/$(($port + $offset))}
  done
  
  # Construct final regex:
  echo ":("${default_ports// /|}")"
}

# The used Sun webserver does allow to set the socket option SO_REUSEADDR.
# Therefore, a subsequent JUnit test may fail with "address already in use"
# because the webinterface of an XtreemFS server from a previous test is still
# in the TIME_WAIT state
function wait_for_time_wait_ports() {
  ports_regex=$(get_webinterface_ports)
  
{'fraction_non_alphanumeric': 0.1251733703190014, 'fraction_numerical': 0.03918169209431346, 'mean_word_length': 4.342592592592593, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '5429891', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1020, 'n_words': 318}