VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /usr/local/lib/node_modules/mediasoup/worker/deps/lcov/test/lcov_summary/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/node_modules/mediasoup/worker/deps/lcov/test/lcov_summary/check_counts
#!/usr/bin/env perl
#
# Copyright IBM Corp. 2017
#
# Usage: check_counts <counts_file> <coverage_data_file>
#
# Compare the output of "lcov --summary" for <coverage_data_file> with the
# coverage data counts specified in <counts_file>. This file has the following
# format (all in a single line):
#
#   lnhit lnfound fnhit fnfound brhit brfound2
#

use strict;
use warnings;

sub do_cmp($$$)
{
	my ($title, $a, $b) = @_;

	if ($a == $b) {
		print("$title: $a == $b\n");
		return 0;
	} else {
		print("$title: $a != $b => mismatch!\n");
		return 1;
	}
}

my $lcov = $ENV{"LCOV"};
my ($counts, $info) = @ARGV;
my $fd;
my $cmdline;
my ($lnhit, $lnfound, $fnhit, $fnfound, $brhit, $brfound) = (0, 0, 0, 0, 0, 0);
my ($lnhit2, $lnfound2, $fnhit2, $fnfound2, $brhit2, $brfound2);
my $rc = 0;

die("$0: LCOV environment variable not defined\n") if (!defined($lcov));
if (!defined($counts) || !defined($info)) {
	die("Usage: $0 <counts_file> <coverage_data_file>\n");
}

$cmdline = "$lcov --summary $info";
open($fd, "-|", $cmdline) or die("$0: Could not run $cmdline: $!\n");
while (<$fd>) {
	($lnhit, $lnfound) = ($1, $2) if (/(\d+) of (\d+) lines/);
	($fnhit, $fnfound) = ($1, $2) if (/(\d+) of (\d+) functions/);
	($brhit, $brfound) = ($1, $2) if (/(\d+) of (\d+) branches/);
}
close($fd);

die("$0: Non-zero result code ($?) of command: $cmdline\n") if ($? != 0);

open($fd, "<", $counts) or die("$0: Could not open $counts: $!\n");
if (<$fd> !~ /^(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/) {
	die("$0: Invalid count file: $counts\n");
}
($lnhit2, $lnfound2, $fnhit2, $fnfound2, $brhit2, $brfound2) =
	($1, $2, $3, $4, $5, $6);
close($fd);

print("Comparing --summary output for $info and $counts:\n");
$rc |= do_cmp("line hit", $lnhit, $lnhit2);
$rc |= do_cmp("line found", $lnfound, $lnfound2);
$rc |= do_cmp("functions hit", $fnhit, $fnhit2);
$rc |= do_cmp("functions found", $fnfound, $fnfound2);
$rc |= do_cmp("branches hit", $brhit, $brhit2);
$rc |= do_cmp("branches found", $brfound, $brfound2);

exit($rc);

VaKeR 2022