<commit_before>##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
##########################################################################

import re, socket, httplib, traceback, os, subprocess, select, datetime, glob, time
import tests, debug, siteconfig
from common import TestCommon, TimeoutError, select_timeout
from results import ResultsBase, PassFailResult, RowResults


WEBSERVER_TEST_FILES=['index.html', 'barrelfish.gif', 'barrelfish_sosp09.pdf']
WEBSERVER_TEST_FILES=['index.html', 'bigfile.bz2', 'bigfile.2.bz2', 'nevill-master-capabilities.pdf']
WEBSERVER_TEST_FILES=['nevill-master-capabilities.pdf']
WEBSERVER_TEST_FILES=['index.html']

#'razavi-master-performanceisolation.pdf']

WEBSERVER_TIMEOUT=5 # seconds
TEST_LOG_NAME = 'testlog.txt'

HTTPERF_BASE_ARGS='--hog --close-with-reset --timeout 2 '
HTTPERF_URI = '/index.html'

# Webserver stress test, It will download index page repeatedly for following
#       number of times
WEBSERVER_STRESS_COUNTER = 3000

# desired duration of an httperf test run (seconds)
HTTPERF_DURATION = 20

# sleep time between runs (seconds)
HTTPERF_SLEEPTIME = 20

# timeout for a complete run, including setup etc.
HTTPERF_TIMEOUT = datetime.timedelta(seconds=(HTTPERF_DURATION + 30))

# connection rates across all client machines
HTTPERF_STARTRATE = 1000  # initial rate
HTTPERF_RATEINCREMENT = 1000  # amount to increment by for each new run


class WebCommon(TestCommon):

    def __init__(self, options):
        super(WebCommon, self).__init__(options)
        self.test_timeout_delta = datetime.timedelta(seconds=600)

    def setup(self, build, machine, testdir):
        super(WebCommon, self).setup(build, machine, testdir)
        self.testdir = testdir
        self.finished = False
        self.ip = None

    def get_modules(self, build, machine):
        cardName = "e1000"
        modules = super(WebCommon, self).get_modules(build, machine)
        modules.add_module("e1000n", ["core=%d" % machine.get_coreids()[3]]) # 1
        modules.add_module("NGD_mng", ["core=%d" % machine.get_coreids()[1], #2
                                    "cardname=%s"%cardName])
        modules.add_module("netd", ["core=%d" % machine.get_coreids()[1], #2
                                   "cardname=%s"%cardName])
        nfsip = socket.gethostbyname(siteconfig.get('WEBSERVER_NFS_HOST'))
        modules.add_module("webserver", ["core=%d" % machine.get_coreids()[2], #2
				cardName, nfsip,
                                         siteconfig.get('WEBSERVER_NFS_PATH')])
#                                         siteconfig.get('WEBSERVER_NFS_TEST_PATH')])
        return modules

    def process_line(self, line):
        m = re.match(r'Interface up! IP address (\d+\.\d+\.\d+\.\d+)', line)
        if m:
            self.ip = m.group(1)<commit_msg>harness: webserver tests: let Kaluga start e1000n, NGD_mng, and netd<commit_after>##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
##########################################################################

import re, socket, httplib, traceback, os, subprocess, datetime, glob, time
import tests, debug, siteconfig
from common import TestCommon, TimeoutError, select_timeout
from results import ResultsBase, PassFailResult, RowResults


WEBSERVER_TEST_FILES=['index.html', 'barrelfish.gif', 'barrelfish_sosp09.pdf']
WEBSERVER_TEST_FILES=['index.html', 'bigfile.bz2', 'bigfile.2.bz2', 'nevill-master-capabilities.pdf']
WEBSERVER_TEST_FILES=['nevill-master-capabilities.pdf']
WEBSERVER_TEST_FILES=['index.html']

#'razavi-master-performanceisolation.pdf']

WEBSERVER_TIMEOUT=5 # seconds
TEST_LOG_NAME = 'testlog.txt'

HTTPERF_BASE_ARGS='--hog --close-with-reset --timeout 2 '
HTTPERF_URI = '/index.html'

# Webserver stress test, It will download index page repeatedly for following
#       number of times
WEBSERVER_STRESS_COUNTER = 3000

# desired duration of an httperf test run (seconds)
HTTPERF_DURATION = 20

# sleep time between runs (seconds)
HTTPERF_SLEEPTIME = 20

# timeout for a complete run, including setup etc.
HTTPERF_TIMEOUT = datetime.timedelta(seconds=(HTTPERF_DURATION + 30))

# connection rates across all client machines
HTTPERF_STARTRATE = 1000  # initial rate
HTTPERF_RATEINCREMENT = 1000  # amount to increment by for each new run


class WebCommon(TestCommon):

    def __init__(self, options):
        super(WebCommon, self).__init__(options)
        self.test_timeout_delta = datetime.timedelta(seconds=600)

    def setup(self, build, machine, testdir):
        super(WebCommon, self).setup(build, machine, testdir)
        self.testdir = testdir
        self.finished = False
        self.ip = None

    def get_modules(self, build, machine):
        cardName = "e1000"
        modules = super(WebCommon, self).get_modules(build, machine)
        modules.add_module("e1000n", ["auto"])
        modules.add_module("NGD_mng", ["auto"])
        modules.add_module("netd", ["auto"])
        nfsip = socket.gethostbyname(siteconfig.get('WEBSERVER_NFS_HOST'))
        modules.add_module("webserver", ["core=%d" % machine.get_coreids()[2], #2
				cardName, nfsip,
                                         siteconfig.get('WEBSERVER_NFS_PATH')])
#                                         siteconfig.get('WEBSERVER_NFS_TEST_PATH')])
        return modules

    def process_line(self, line):
        m = re.match(r'Interface up! IP address (\d+\.\d+\.\d+\.\d+)', line)
        if m:
            self.ip = m.group(1)
{'fraction_non_alphanumeric': 0.1579993375289831, 'fraction_numerical': 0.017555481947664788, 'mean_word_length': 3.7290524667188722, 'pattern_counts': {'":': 0, '<': 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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3289322', 'n_tokens_mistral': 1958, 'n_tokens_neox': 1851, 'n_words': 459}