• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it would be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * Further, this software is distributed without any warranty that it is
13  * free of the rightful claim of any third person regarding infringement
14  * or the like.  Any license provided herein, whether implied or
15  * otherwise, applies only to this software file.  Patent licenses, if
16  * any, provided herein do not apply to combinations of this program with
17  * other software, or any other product whatsoever.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  *
23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24  * Mountain View, CA  94043, or:
25  *
26  * http://www.sgi.com
27  *
28  * For further information regarding this notice, see:
29  *
30  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
31  *
32  */
33 /* $Id: ltp-scanner.c,v 1.1 2009/05/19 09:39:11 subrata_modak Exp $ */
34 /*
35  * An RTS/pan driver output processing program.
36  *
37  * This program reads an RTS/pan driver output format file, parses it using lex
38  * and saves the information into an in-memory hierarchical keyword table.
39  *
40  * The reporting segment of the program reads that keyword table to produce
41  * it's reports.
42  *
43  * Synopsis:
44  * 	ltp-scanner [ -e ] [ -D area:level ] [ -h ]
45  *
46  * Description:
47  *   Scanner is part of the RTS 2.0 reporting mechanism or pan.
48  *   It processes RTS/pan driver format output and produces a single simple report
49  *   of each test tag executed, the TCIDs it executed, and their testcases.
50  *
51  * Options:
52  *   -e
53  *	use an "extended" output format
54  *
55  *   -D
56  *	enable debug statements.  Areas are listed in report2.h and levels
57  *	are in the code.  Must be compiled with "-DDEBUGGING"
58  *
59  *   -h
60  *	print out a command usage statement and exit.
61  *
62  * INPUT
63  *   The input must conform to the RTS/pan driver format.
64  *
65  * Report Format
66  *   A single report style is used.  It consists of a header made of all
67  *   keywords in the rts_keywords fields of the driver output, and the test
68  *   information.
69  *	interpretation of CUTS "number of testcases" field when there are
70  *	multiple TCIDs.  It must be the sum of all TCIDs' testcases.
71  *
72  * System Configuration:
73  * ARCHITECTURE         IOS_MODEL_E CRAY_YMP YMP7XX
74  * CONFIG               JOBCNTL AVL BMD EMA HPM SECURE TFM_UDB_6 SDS SSD
75  * RELEASE              82
76  * UNAME                sn1703c cool 8.2.0ae d82.25
77  * date                 03/24/94
78  *
79  * tag		tcid		testcase	status		contact
80  * ------------------------------------------------------------------------
81  *
82  *   When a report is made for only a tag, the TCID and Testcase fields
83  *   contain a dash ( "-" ).  The intention is that the output be usable
84  *   by other Unix programs.
85  *
86  *   When a report is made for all TCIDs and Testcases, a star ( "*" ) is used.
87  *
88  *   When in extended mode, an additional output line is produced for each
89  *   tag.
90  *
91  *	This line is identified with a "!" in the TCID and Testcase fields.
92  *
93  *	It has no minimum and maximum field widths, so the output does not
94  *	line up in columns
95  *
96  *	the "status" field contains the initiation status
97  *
98  *	the "contact" field does not expand multiple comma-separated contacts
99  *
100  *	fields:
101  *		tag, tcid, testcase, status, contact,
102  *		start time, duration, termination type, termination id,
103  *		output starting line, output ending line
104  *
105  * RELATED DOCUMENTS
106  *	Regression Test System Phase 2 Test Result Reporting System
107  *
108  * AUTHOR
109  *   Glen Overby wrote the code.
110  *
111  * Internal Data Format
112  *   All data is maintained in a hierarchical key database.  While there are
113  *   many available databases, this impliments a simple ASCII comma-separated
114  *   keyed database.
115  *
116  *   Key Naming
117  *	- The top-level keys are named after the RTS or pan test tags.
118  *	- The top-level key named "_RTS" contains the RTS Keywords
119  *	- Each tag has a "_keys" tag that contains the key fields from
120  *	  the TEST_START and EXECUTION_STATUS fields.
121  */
122 
123 #include <getopt.h>
124 #include <stdarg.h>
125 #include <stdio.h>
126 #include <stdlib.h>
127 #include <string.h>
128 #include <unistd.h>
129 #include "scan.h"
130 #include "debug.h"
131 #include "reporter.h"
132 #include "symbol.h"
133 
134 char *cnf;			/* current filename */
135 int extended = 0;		/* -e option        */
136 
main(int argc,char * argv[])137 int main(int argc, char *argv[])
138 {
139 	SYM tags;		/* tag data */
140 	int c;
141 
142 	while ((c = getopt(argc, argv, "D:ehi")) != -1) {
143 		switch (c) {
144 		case 'i':
145 			set_iscanner();
146 			break;
147 		case 'D':
148 			set_debug(optarg);
149 			break;
150 		case 'e':
151 			extended++;
152 			break;
153 		case 'h':
154 			fprintf(stderr,
155 				"%s [-e] [-i] [ -D area, level ] input-filenames\n",
156 				argv[0]);
157 			exit(0);
158 		default:
159 			fprintf(stderr, "invalid argument, %c\n", c);
160 			exit(1);
161 		}
162 	}
163 
164 	lex_files(&argv[optind]);	/* I hope that argv[argc+1] == NULL */
165 	tags = sym_open(0, 0, 0);
166 
167 	scanner(tags);
168 #ifdef DEBUGGING
169 	DEBUG(D_INIT, 1)
170 	    sym_dump_s(tags, 0);
171 #endif
172 	reporter(tags);
173 
174 	exit(0);
175 }
176