<commit_before>#!/usr/bin/env sh
# Script for running automated CBench regression tests

EX_USAGE=64
EX_CBENCH_NOT_FOUND=65
EX_OK=0
EX_ERR=1

cbench_installed()
{
    # Checks if CBench is installed
    if command -v cbench &>/dev/null; then
        echo "CBench is installed"
        return $EX_OK
    else
        echo "CBench is not installed"
        return $EX_CBENCH_NOT_FOUND
    fi
}

install_cbench()
{
    # Installs CBench, including its dependencies
    # This function is idempotent
    # Note that I'm not currently building oflops/netfpga-packet-generator-c-library (optional)
    if cbench_installed; then
        return $EX_OK
    fi

    # Install required packages
    sudo yum install -y net-snmp-devel libpcap-devel autoconf make automake libtool libconfig-devel git

    # Clone repo that contains CBench
    git clone https://github.com/andi-bigswitch/oflops.git

    # CBench requires the OpenFlow source code, clone it
    git clone git://gitosis.stanford.edu/openflow.git
    of_dir="$PWD/openflow"

    # Build the oflops/configure file
    cd oflops
    ./boot.sh

    # Build oflops
    # TODO: Git abs path
    ./configure --with-openflow-src-dir=$of_dir
    make
    sudo make install
    cd ..

    if ! cbench_installed; then
        echo "Failed to install CBench" >&2
        exit $EX_ERR
    else
        echo "Successfully installed CBench"
        return $EX_OK
    fi
}

install_cbench<commit_msg>Stubbed out some future methods<commit_after>#!/usr/bin/env sh
# Script for running automated CBench regression tests

EX_USAGE=64
EX_CBENCH_NOT_FOUND=65
EX_OK=0
EX_ERR=1

cbench_installed()
{
    # Checks if CBench is installed
    if command -v cbench &>/dev/null; then
        echo "CBench is installed"
        return $EX_OK
    else
        echo "CBench is not installed"
        return $EX_CBENCH_NOT_FOUND
    fi
}

install_cbench()
{
    # Installs CBench, including its dependencies
    # This function is idempotent
    # This has been tested on fresh cloud versions of Fedora 20 and CentOS 6.5
    # Note that I'm not currently building oflops/netfpga-packet-generator-c-library (optional)
    if cbench_installed; then
        return $EX_OK
    fi

    # Install required packages
    sudo yum install -y net-snmp-devel libpcap-devel autoconf make automake libtool libconfig-devel git

    # Clone repo that contains CBench
    git clone https://github.com/andi-bigswitch/oflops.git

    # CBench requires the OpenFlow source code, clone it
    git clone git://gitosis.stanford.edu/openflow.git
    of_dir="$PWD/openflow"

    # Build the oflops/configure file
    cd oflops
    ./boot.sh

    # Build oflops
    ./configure --with-openflow-src-dir=$of_dir
    make
    sudo make install
    cd ..

    if ! cbench_installed; then
        echo "Failed to install CBench" >&2
        exit $EX_ERR
    else
        echo "Successfully installed CBench"
        return $EX_OK
    fi
}

start_opendaylight()
{
    # Starts the OpenDaylight controller
    # TODO
}

run_cbench()
{
    # Runs the CBench test against the controller
    # TODO
}

install_cbench
{'fraction_non_alphanumeric': 0.07223476297968397, 'fraction_numerical': 0.005804579168010319, 'mean_word_length': 2.6884661117717004, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1627323', 'n_tokens_mistral': 1051, 'n_tokens_neox': 985, 'n_words': 306}