blob: afdd757759d98a614d5c69604105d1f79543c68c [file] [log] [blame]
alaffinf5589902000-09-21 21:35:06 +00001/*
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
Wanlong Gaofed96412012-10-24 10:10:29 +080020 * with this program; if not, write the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
alaffinf5589902000-09-21 21:35:06 +000022 *
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 */
subrata_modak14390fd2009-05-19 09:39:11 +000033/* $Id: ltp-scanner.c,v 1.1 2009/05/19 09:39:11 subrata_modak Exp $ */
alaffinf5589902000-09-21 21:35:06 +000034/*
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
Garrett Cooper1e6f5a62010-12-19 09:58:10 -080041 * it's reports.
alaffinf5589902000-09-21 21:35:06 +000042 *
43 * Synopsis:
subrata_modak14390fd2009-05-19 09:39:11 +000044 * ltp-scanner [ -e ] [ -D area:level ] [ -h ]
alaffinf5589902000-09-21 21:35:06 +000045 *
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:
Garrett Cooper1e6f5a62010-12-19 09:58:10 -080073 * ARCHITECTURE IOS_MODEL_E CRAY_YMP YMP7XX
74 * CONFIG JOBCNTL AVL BMD EMA HPM SECURE TFM_UDB_6 SDS SSD
75 * RELEASE 82
alaffinf5589902000-09-21 21:35:06 +000076 * 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 */
Garrett Cooper6ea8c5b2011-02-23 00:14:59 -0800122
123#include <getopt.h>
124#include <stdarg.h>
alaffinf5589902000-09-21 21:35:06 +0000125#include <stdio.h>
126#include <stdlib.h>
alaffinf5589902000-09-21 21:35:06 +0000127#include <string.h>
Garrett Cooper6ea8c5b2011-02-23 00:14:59 -0800128#include <unistd.h>
alaffinf5589902000-09-21 21:35:06 +0000129#include "scan.h"
130#include "debug.h"
131#include "reporter.h"
132#include "symbol.h"
133
Wanlong Gao354ebb42012-12-07 10:10:04 +0800134char *cnf; /* current filename */
135int extended = 0; /* -e option */
alaffinf5589902000-09-21 21:35:06 +0000136
subrata_modak14390fd2009-05-19 09:39:11 +0000137int main(int argc, char *argv[])
alaffinf5589902000-09-21 21:35:06 +0000138{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800139 SYM tags; /* tag data */
subrata_modak14390fd2009-05-19 09:39:11 +0000140 int c;
alaffinf5589902000-09-21 21:35:06 +0000141
subrata_modak14390fd2009-05-19 09:39:11 +0000142 while ((c = getopt(argc, argv, "D:ehi")) != -1) {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800143 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);
subrata_modak14390fd2009-05-19 09:39:11 +0000161 }
alaffinf5589902000-09-21 21:35:06 +0000162 }
alaffinf5589902000-09-21 21:35:06 +0000163
subrata_modak14390fd2009-05-19 09:39:11 +0000164 lex_files(&argv[optind]); /* I hope that argv[argc+1] == NULL */
165 tags = sym_open(0, 0, 0);
alaffinf5589902000-09-21 21:35:06 +0000166
subrata_modak14390fd2009-05-19 09:39:11 +0000167 scanner(tags);
alaffinf5589902000-09-21 21:35:06 +0000168#ifdef DEBUGGING
subrata_modak14390fd2009-05-19 09:39:11 +0000169 DEBUG(D_INIT, 1)
Wanlong Gao354ebb42012-12-07 10:10:04 +0800170 sym_dump_s(tags, 0);
alaffinf5589902000-09-21 21:35:06 +0000171#endif
subrata_modak14390fd2009-05-19 09:39:11 +0000172 reporter(tags);
alaffinf5589902000-09-21 21:35:06 +0000173
subrata_modak14390fd2009-05-19 09:39:11 +0000174 exit(0);
Garrett Cooper6ea8c5b2011-02-23 00:14:59 -0800175}