<commit_before>#!/usr/local/bin/tclsh
# This program combines a ns input file and a post-assign IR file
# to add the ip and ip-mac sections to the ir file.


set scriptdir [file dirname [info script]]
set updir [file dirname $scriptdir]
#set mactable "$updir/switch_tools/intel510/macslist"
source "$scriptdir/libir.tcl"
load $updir/../lib/sql.so
set DB [sql connect]
sql selectdb $DB tbdb

namespace import TB_LIBIR::ir

if {[llength $argv] != 2} {
    puts stderr "Syntax: $argv0 <irfile> <nsfile>"
    exit 1
}

set irfile [lindex $argv 0]
set nsfile [lindex $argv 1]


# Extract testbed commands
set tbcommands [exec $scriptdir/extract_tb.tcl < $nsfile]

# Read ir file
ir read $irfile

# Parse testbed commands
foreach cmd [split $tbcommands "\n"] {
    set c [lindex $cmd 0]
    switch -- $c {<commit_msg>Fixed to work with new installation pattern.<commit_after>#!/usr/local/bin/tclsh
# This program combines a ns input file and a post-assign IR file
# to add the ip and ip-mac sections to the ir file.


set scriptdir [file dirname [info script]]
set updir [file dirname $scriptdir]
#set mactable "$updir/switch_tools/intel510/macslist"
source "$scriptdir/libir.tcl"
if {[file exists $updir/../lib/sql.so]} {
    load $updir/../lib/sql.so
} else {
    load $updir/../sql.so
}

set DB [sql connect]
sql selectdb $DB tbdb

namespace import TB_LIBIR::ir

if {[llength $argv] != 2} {
    puts stderr "Syntax: $argv0 <irfile> <nsfile>"
    exit 1
}

set irfile [lindex $argv 0]
set nsfile [lindex $argv 1]


# Extract testbed commands
set tbcommands [exec $scriptdir/extract_tb.tcl < $nsfile]

# Read ir file
ir read $irfile

# Parse testbed commands
foreach cmd [split $tbcommands "\n"] {
    set c [lindex $cmd 0]
    switch -- $c {
{'fraction_non_alphanumeric': 0.11974668969487623, 'fraction_numerical': 0.010362694300518135, 'mean_word_length': 3.7616438356164386, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '5291612', 'n_tokens_mistral': 640, 'n_tokens_neox': 615, 'n_words': 221}