OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [infra/] [testcase.cxx] - Blame information for rev 596

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//==========================================================================
2
//
3
//      testcase.cxx
4
//
5
//      Host side implementation of the test support routines.
6
//
7
//==========================================================================
8
//####COPYRIGHTBEGIN####
9
//                                                                          
10
// ----------------------------------------------------------------------------
11
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
12
//
13
// This file is part of the eCos host tools.
14
//
15
// This program is free software; you can redistribute it and/or modify it 
16
// under the terms of the GNU General Public License as published by the Free 
17
// Software Foundation; either version 2 of the License, or (at your option) 
18
// any later version.
19
// 
20
// This program is distributed in the hope that it will be useful, but WITHOUT 
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
23
// more details.
24
// 
25
// You should have received a copy of the GNU General Public License along with
26
// this program; if not, write to the Free Software Foundation, Inc., 
27
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28
//
29
// ----------------------------------------------------------------------------
30
//                                                                          
31
//####COPYRIGHTEND####
32
//==========================================================================
33
//#####DESCRIPTIONBEGIN####                                             
34
//
35
// Author(s):           bartv
36
// Contributors:        bartv
37
// Date:                1998-01-01
38
// Purpose:
39
// Description:
40
//
41
//####DESCRIPTIONEND####
42
//==========================================================================
43
 
44
#include <cstdio>
45
#include <cstdlib>
46
 
47
#include <cyg/infra/testcase.h>
48
 
49
// Initialization is a no-op for the host side testing infrastructure.
50
// Only batch programs are likely to use these testing facilities so
51
// it is safe to assume that stdio is available.
52
 
53
externC void
54
cyg_test_init(void)
55
{
56
}
57
 
58
// This simply implements the current interface, warts and all.
59
// It is necessary to keep track of any failures or invalid
60
// calls.
61
static int failures = 0;
62
 
63
externC void
64
cyg_test_output(Cyg_test_code status, const char* msg, int line_number, const char* file)
65
{
66
    if (CYGNUM_TEST_FAIL == status)
67
        failures++;
68
 
69
    if (0 == msg)
70
        msg = "";
71
    if (0 == file)
72
        file = "";
73
 
74
    if (CYGNUM_TEST_FAIL == status) {
75
        printf("FAIL:<%s> Line: %d, File: %s\n", msg, line_number, file);
76
    } else {
77
        printf("%s:<%s>\n",
78
               (CYGNUM_TEST_PASS == status)   ? "PASS" :
79
               (CYGNUM_TEST_EXIT == status)   ? "EXIT" :
80
               (CYGNUM_TEST_INFO == status)   ? "INFO" :
81
               (CYGNUM_TEST_GDBCMD == status) ? "GDBCMD" :
82
               (CYGNUM_TEST_NA == status)     ? "NA" : "UNKNOWN STATUS",
83
               msg);
84
    }
85
 
86
}
87
 
88
externC void
89
cyg_test_exit(void)
90
{
91
    exit( (0 < failures) ? EXIT_FAILURE : EXIT_SUCCESS );
92
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.