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