<commit_before>#!/usr/bin/perl -w
# DESCRIPTION: Perl ExtUtils: Type 'make test' to test this package
#
# Copyright 2000-2009 by <NAME>.  This program is free software;
# you can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.

use IO::File;
use strict;
use Test;

BEGIN { plan tests => 5 }
BEGIN { require "t/test_utils.pl"; }

print "Checking vpassert...\n";

# Preprocess the files
mkdir "test_dir/.vpassert", 0777;
system ("/bin/rm -rf test_dir/verilog");
symlink ("../verilog", "test_dir/verilog");  # So `line files are found; ok if fails
run_system ("${PERL} vpassert --minimum --nostop -o test_dir/.vpassert --date -y verilog/");
ok(1);
ok(-r 'test_dir/.vpassert/pli.v');

ok(compare('lines', [glob("test_dir/.vpassert/*.v")]));
ok(compare('diff',  [glob("test_dir/.vpassert/*.v")]));

# Build the model
unlink "simv";
chdir 'test_dir';
if ($ENV{VCS_HOME} && -r "$ENV{VCS_HOME}/bin/vcs") {
    run_system (# We use VCS, insert your simulator here
		"$ENV{VCS_HOME}/bin/vcs"
		# vpassert uses `pli to point to the hierarchy of the pli module
		." +define+pli=pli"
		# vpassert uses `__message_on to point to the message on variable
		." +define+__message_on=pli.message_on"
		# vpassert --minimum uses `__message_minimum to optimize away some messages
		." +define+__message_minimum=1"
		# Read files from .vpassert BEFORE reading from other directories
		." +librescan +libext+.v -y .vpassert"
		# Finally, read the needed top level file
		." .vpassert/example.v"
		);
    # Execute the model (VCS is a compiled simulator)
    run_system ("./simv");
    unlink ("./simv");
    ok(1);
}
elsif ($ENV{NC_ROOT} && -d "$ENV{NC_ROOT}/tools") {
    run_system ("ncverilog"
		." -q"
		# vpassert optionally uses SystemVerilog coverage for $ucover_clk
		." +sv"
		# vpassert uses `pli to point to the hierarchy of the pli module
		." +define+pli=pli"
		# vpassert uses `__message_on to point to the message on variable
		." +define+__message_on=pli.message_on"
		# vpassert --minimum uses `__message_minimum to optimize away some messages
		." +define+__message_minimum=1"
		# Read files from .vpassert BEFORE reading from other directories
		." +librescan +libext+.v -y .vpassert"<commit_msg>Fix 60_vpassert.t under VCS<commit_after>#!/usr/bin/perl -w
# DESCRIPTION: Perl ExtUtils: Type 'make test' to test this package
#
# Copyright 2000-2009 by <NAME>.  This program is free software;
# you can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.

use IO::File;
use strict;
use Test;

BEGIN { plan tests => 5 }
BEGIN { require "t/test_utils.pl"; }

print "Checking vpassert...\n";

# Preprocess the files
mkdir "test_dir/.vpassert", 0777;
system ("/bin/rm -rf test_dir/verilog");
symlink ("../verilog", "test_dir/verilog");  # So `line files are found; ok if fails
run_system ("${PERL} vpassert --minimum --nostop -o test_dir/.vpassert --date -y verilog/");
ok(1);
ok(-r 'test_dir/.vpassert/pli.v');

ok(compare('lines', [glob("test_dir/.vpassert/*.v")]));
ok(compare('diff',  [glob("test_dir/.vpassert/*.v")]));

# Build the model
unlink "simv";
chdir 'test_dir';
if (!$ENV{VERILATOR_AUTHOR_SITE}) {
    skip("author only test (harmless)",1);
}
elsif ($ENV{VCS_HOME} && -r "$ENV{VCS_HOME}/bin/vcs") {
    run_system (# We use VCS, insert your simulator here
		"$ENV{VCS_HOME}/bin/vcs"
		# vpassert optionally uses SystemVerilog coverage for $ucover_clk
		." -sverilog"
		# vpassert uses `pli to point to the hierarchy of the pli module
		." +define+pli=pli"
		# vpassert uses `__message_on to point to the message on variable
		." +define+__message_on=pli.message_on"
		# vpassert --minimum uses `__message_minimum to optimize away some messages
		." +define+__message_minimum=1"
		# Read files from .vpassert BEFORE reading from other directories
		." +librescan +libext+.v -y .vpassert"
		# Finally, read the needed top level file
		." .vpassert/example.v"
		);
    # Execute the model (VCS is a compiled simulator)
    run_system ("./simv");
    unlink ("./simv");
    ok(1);
}
elsif ($ENV{NC_ROOT} && -d "$ENV{NC_ROOT}/tools") {
    run_system ("ncverilog"
		." -q"
		# vpassert optionally uses SystemVerilog coverage for $ucover_clk
		." +sv"
		# vpassert uses `pli to point to the hierarchy of the pli module
		." +define+pli=pli"
		# vpassert uses `__message_on to point to the message on variable
		." +define+__message_on=pli.message_on"
		# vpassert --minimum uses `__message_minimum to optimize away some messages
		." +define+__message_minimum=1"
		# Read files from .vpassert BEFORE reading from other directories
		." +librescan +libext+.v -y .vpassert"
{'fraction_non_alphanumeric': 0.13809723386420789, 'fraction_numerical': 0.00901089689857502, 'mean_word_length': 3.9979057591623035, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2078526', 'n_tokens_mistral': 1779, 'n_tokens_neox': 1669, 'n_words': 520}