No subject


Thu Jul 12 09:23:04 CDT 2007


Merged revisions 4517-4518 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

Modified:
    branches/1.4/   (props changed)
    branches/1.4/kernel/xpp/init_card_2_30

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/kernel/xpp/init_card_2_30
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/xpp/init_card_2_30?view=diff&rev=4524&r1=4523&r2=4524
==============================================================================
--- branches/1.4/kernel/xpp/init_card_2_30 (original)
+++ branches/1.4/kernel/xpp/init_card_2_30 Tue Sep  9 10:18:01 2008
@@ -50,7 +50,7 @@
 my %opts;
 $ENV{XPP_BASE} = '/proc/xpp';
 
-getopts('o:', \%opts);
+getopts('o:v:', \%opts);
 
 my $debug;
 
@@ -127,9 +127,9 @@
 CANADA         	reg16=00	reg26=C0	reg30=00	reg31=20		
 CHILE          	reg16=00	reg26=C0	reg30=00	reg31=20		
 CHINA          	reg16=00	reg26=30	reg30=0F	reg31=20		
-COLUMBIA       	reg16=00	reg26=C0	reg30=00	reg31=20		
+COLOMBIA       	reg16=00	reg26=C0	reg30=00	reg31=20		
 CROATIA        	reg16=00	reg26=C2	reg30=02	reg31=20		
-CYRPUS         	reg16=00	reg26=C2	reg30=02	reg31=20		
+CYPRUS         	reg16=00	reg26=C2	reg30=02	reg31=20		
 CZECH          	reg16=00	reg26=C2	reg30=02	reg31=20		
 DENMARK        	reg16=00	reg26=C2	reg30=02	reg31=28		
 ECUADOR        	reg16=00	reg26=C0	reg30=00	reg31=20		
@@ -263,6 +263,8 @@
 sub opermode_verify($) {
 	my $input = shift or die;
 	my %verification_table;
+	my %location_lines;
+	my $mismatches = 0;
 
 	open(F, $input) or die "$0: Failed opening '$input': $!\n";
 	while(<F>) {
@@ -275,32 +277,38 @@
 			my ($key, $val) = split(/=/, $p, 2);
 			$verification_table{$location}{$key} = $val;
 		}
+		$location_lines{$location} = $.;
 	}
 	close F;
 	# First test: check for missing data in our program
 	foreach my $location (sort keys %verification_table) {
 		my $mode = $opermode_table{$location};
 		if(! defined $mode) {
-			printf STDERR  "Missing $location\n";
+			printf STDERR  "Missing from $0: '$location' at $input:$location_lines{$location}\n";
+			$mismatches++;
 			next;
 		}
 		my $verify_mode = $verification_table{$location};
 		my $str1 = opermode_to_string($mode);
 		my $str2 = opermode_to_string($verify_mode);
 		if($str1 ne $str2) {
-			print STDERR  "DIFF: $location:\n";
+			print STDERR  "DIFF: '$location' at $input:$location_lines{$location}\n";
 			printf STDERR  "\t%-20s: %s\n", "program", $str1;
 			printf STDERR  "\t%-20s: %s\n", "verify", $str2;
+			$mismatches++;
 		}
 	}
 	# Second test: check for extra data in our program
 	foreach my $location (sort keys %opermode_table) {
 		my $mode = $verification_table{$location};
 		if(! defined $mode) {
-			printf STDERR  "Extra $location\n";
+			printf STDERR  "Extra in $0 '$location'\n";
+			$mismatches++;
 			next;
 		}
 	}
+	print STDERR "Total $mismatches mismatches\n" if $mismatches;
+	return $mismatches;
 }
 
 sub read_defaults() {
@@ -331,11 +339,12 @@
 
 FXO::opermode_preprocess;	# Must be first
 
-if(@ARGV and $ARGV[0] =~ /^verify(.*)/) {
-	my $verify_file = $1;
-	die "Usage: $0 verify=filename\n" unless $verify_file =~ s/^=//;
+if($opts{v}) {
+	my $verify_file = $opts{v};
+	die "Usage: $0 [-v verify_filename]\n" unless $verify_file;
 	main::debug "$0: opermode verification (input='$verify_file')";
-	FXO::opermode_verify($verify_file);
+	my $mismatches = FXO::opermode_verify($verify_file);
+	die "$0: Verification against $verify_file failed\n" if $mismatches != 0;
 	exit 0;
 }
 




More information about the zaptel-commits mailing list