<commit_before># include.tcl
# File for putting general test procedures

# Models should be able to complete within the timeout value.
set timeout 120

proc makeAbsolute {pathname} {
    file join [pwd] $pathname
}

set LTSMIN_SRCDIR "[makeAbsolute $srcdir]/.."

# The directory containing all the models used for testing.
set EXAMPLES_PATH "$LTSMIN_SRCDIR/examples"

# filter: filter a specific (list of) backend(s): {mc,sym,seq,dist}
proc find_alg_backends { filter } {
    global base_dir
    set backends [list]
    set lts_backends [glob -directory "$base_dir/../src" -type d pins2lts-$filter ]
    foreach dir $lts_backends {
        set lts_bins [glob -nocomplain -directory $dir -type f *2lts-$filter ]
        foreach path $lts_bins {
            lappend backends $path
        }
        set lts_bins [glob -nocomplain -directory $dir/gcc -type f *2lts-$filter ]
        foreach path $lts_bins {
            lappend backends $path
        }
        set lts_bins [glob -nocomplain -directory $dir/mpicc -type f *2lts-$filter ]
        foreach path $lts_bins {
            lappend backends $path
        }
    }

    return $backends
}

proc find_lang_frontends { filter } {
    global base_dir
    set frontends [list]
    set lts_backends [glob -directory "$base_dir/../src" -type d pins2lts* ]
    foreach dir $lts_backends {
        set lts_bins [glob -nocomplain -directory $dir -type f $filter]
        foreach path $lts_bins {
            lappend frontends $path
        }
    }

    return $frontends
}

proc runmytest { test_name command_line exp_output} {
    send_user "starting $command_line\n"

    # NOTE: this is ugly. If the exp_output is not set, put an unfindable string in it.
    set unfindable_string "adhadkhaslkdLKHLKHads^*&^876"

    if { [string length $exp_output] == 0 } {
        set exp_output $unfindable_string
    }

    set PID [ eval spawn $command_line ]

    set expected false
    match_max 1000000
    expect {

        # expected last line when execution succeeds
        "writing output took" {
            pass "Program finished\n"
        }

        "not enough arguments" {
            fail "Not enough arguments given for $command_line"
        }

        "File does not exist:" {
            fail "Argument file does not exists"
        }


        "Zobrist and treedbs is not implemented" {
            xfail "The combination of zobrist and treedbs is not implemented";
            catch { exp_close }
            return
        }
	    
        "unimplemented combination --strategy=bfs, --state=table" {
	    xfail "unimplemented combination --strategy=bfs, --state=table";
	    catch { exp_close }
	    return
	}

        "Decision diagram package does not support least fixpoint" {
	    xfail "Decision diagram package does not support least fixpoint";
	    catch { exp_close }
	    return
        }

        # Check for any warning messages in the output first
        Warning {<commit_msg>add unsupported combination in seq tool<commit_after># include.tcl
# File for putting general test procedures

# Models should be able to complete within the timeout value.
set timeout 120

proc makeAbsolute {pathname} {
    file join [pwd] $pathname
}

set LTSMIN_SRCDIR "[makeAbsolute $srcdir]/.."

# The directory containing all the models used for testing.
set EXAMPLES_PATH "$LTSMIN_SRCDIR/examples"

# filter: filter a specific (list of) backend(s): {mc,sym,seq,dist}
proc find_alg_backends { filter } {
    global base_dir
    set backends [list]
    set lts_backends [glob -directory "$base_dir/../src" -type d pins2lts-$filter ]
    foreach dir $lts_backends {
        set lts_bins [glob -nocomplain -directory $dir -type f *2lts-$filter ]
        foreach path $lts_bins {
            lappend backends $path
        }
        set lts_bins [glob -nocomplain -directory $dir/gcc -type f *2lts-$filter ]
        foreach path $lts_bins {
            lappend backends $path
        }
        set lts_bins [glob -nocomplain -directory $dir/mpicc -type f *2lts-$filter ]
        foreach path $lts_bins {
            lappend backends $path
        }
    }

    return $backends
}

proc find_lang_frontends { filter } {
    global base_dir
    set frontends [list]
    set lts_backends [glob -directory "$base_dir/../src" -type d pins2lts* ]
    foreach dir $lts_backends {
        set lts_bins [glob -nocomplain -directory $dir -type f $filter]
        foreach path $lts_bins {
            lappend frontends $path
        }
    }

    return $frontends
}

proc runmytest { test_name command_line exp_output} {
    send_user "starting $command_line\n"

    # NOTE: this is ugly. If the exp_output is not set, put an unfindable string in it.
    set unfindable_string "adhadkhaslkdLKHLKHads^*&^876"

    if { [string length $exp_output] == 0 } {
        set exp_output $unfindable_string
    }

    set PID [ eval spawn $command_line ]

    set expected false
    match_max 1000000
    expect {

        # expected last line when execution succeeds
        "writing output took" {
            pass "Program finished\n"
        }

        "not enough arguments" {
            fail "Not enough arguments given for $command_line"
        }

        "File does not exist:" {
            fail "Argument file does not exists"
        }


        "Zobrist and treedbs is not implemented" {
            xfail "The combination of zobrist and treedbs is not implemented";
            catch { exp_close }
            return
        }
	    
        "unimplemented combination --strategy=bfs, --state=table" {
	    xfail "unimplemented combination --strategy=bfs, --state=table";
	    catch { exp_close }
	    return
	}

        "Decision diagram package does not support least fixpoint" {
	    xfail "Decision diagram package does not support least fixpoint";
	    catch { exp_close }
	    return
        }
        
        "SCC search only works in combination with an accepting state label" {
            xfail "SCC search only works in combination with an accepting state label";
            catch { exp_close }
            return
        }

        # Check for any warning messages in the output first
        Warning {
{'fraction_non_alphanumeric': 0.07779762871528342, 'fraction_numerical': 0.006171836933571545, 'mean_word_length': 2.2983395822174613, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '632215', 'n_tokens_mistral': 1898, 'n_tokens_neox': 1804, 'n_words': 617}