Home | History | Annotate | Download | only in sigaction
      1 #!/usr/bin/perl -w
      2 
      3 # Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
      4 # Created by:  rusty.lynch REMOVE-THIS AT intel DOT com
      5 # This file is licensed under the GPL license.  For the full content
      6 # of this license, see the COPYING file at the top level of this
      7 # source tree.
      8 
      9 
     10 
     11 my (@signals) = ("SIGABRT", "SIGALRM", "SIGBUS", "SIGCHLD", "SIGCONT",
     12 		 "SIGFPE", "SIGHUP", "SIGILL", "SIGINT", "SIGPIPE",
     13 		 "SIGQUIT", "SIGSEGV", "SIGTERM", "SIGTSTP", "SIGTTIN",
     14 		 "SIGTTOU", "SIGUSR1", "SIGUSR2", "SIGPOLL", "SIGPROF",
     15 		 "SIGSYS", "SIGTRAP", "SIGURG", "SIGVTALRM", "SIGXCPU",
     16 		 "SIGXFSZ");
     17 
     18 my (%testcases, $prev);
     19 
     20 $prev = "SIGALRM";
     21 
     22 open (LIST, "ls ./templates/*.in|") or die "Could not get listing";
     23 while (<LIST>) {
     24     my ($fname) = $_;
     25     chomp $fname;
     26 
     27     if ($fname =~ /template_([0-9]*)-.*\.in/) {
     28 	my ($assertion) = $1;
     29 
     30 	open (TEMPLATE, "$fname") or die "Could not open $fname";
     31 	my (@t) = <TEMPLATE>;
     32 	close TEMPLATE;
     33 
     34 	print "Building source based on $fname\n";
     35 	foreach (@signals) {
     36 	    my ($signal) = $_;
     37 
     38 	    $testcases{$assertion}++;
     39 	    open (OUT, ">$assertion-" . $testcases{$assertion} . ".c")
     40 		or die "Could not open source file";
     41 	    foreach (@t) {
     42 		my ($line) = $_;
     43 		$line =~ s/%%MYSIG%%/$signal/;
     44 		$line =~ s/%%MYSIG2%%/$prev/;
     45 		print OUT $line;
     46 	    }
     47 	    close OUT;
     48 
     49 	    $prev = $signal;
     50 	}
     51     }
     52 }
     53 
     54 
     55