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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [infra/] [testcase.cxx] - Blame information for rev 790

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

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

powered by: WebSVN 2.1.0

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