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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [testsuite/] [lib/] [java.exp] - Blame information for rev 1767

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

Line No. Rev Author Line
1 578 markom
# Copyright (C) 1998, 1999 Red Hat, Inc.
2
 
3
load_lib "libgloss.exp"
4
 
5
# GCJ_UNDER_TEST is the compiler under test.
6
 
7
global tmpdir
8
 
9
if ![info exists tmpdir] {
10
    set tmpdir "/tmp"
11
}
12
 
13
set java_initialized 0
14
 
15
#
16
# Build the status wrapper library as needed.
17
#
18
proc java_init { args } {
19
    global wrapper_file;
20
    global wrap_compile_flags;
21
    global java_initialized
22
    global GCJ_UNDER_TEST
23
    global TOOL_EXECUTABLE
24
    global env
25
 
26
    if { $java_initialized == 1 } { return; }
27
 
28
    if ![info exists GCJ_UNDER_TEST] {
29
        if [info exists TOOL_EXECUTABLE] {
30
            set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
31
        } else {
32
            if [info exists env(GCJ)] {
33
                set GCJ_UNDER_TEST $env(GCJ)
34
            } else {
35
                global tool_root_dir
36
 
37
                if ![is_remote host] {
38
                    set file [lookfor_file $tool_root_dir gcj];
39
                    if { $file == "" } {
40
                        set file [lookfor_file $tool_root_dir gcc/gcj];
41
                    }
42
                    if { $file != "" } {
43
                        set CC "$file -B[file dirname $file]/ --specs=$tool_root_dir/$target_alias/libjava/libgcj-test.spec";
44
                    } else {
45
                        set CC [transform gcj];
46
                    }
47
                } else {
48
                    set CC [transform gcj]
49
                }
50
                set GCJ_UNDER_TEST $CC
51
            }
52
        }
53
    }
54
 
55
    set wrapper_file "";
56
    set wrap_compile_flags "";
57
    if [target_info exists needs_status_wrapper] {
58
        set result [build_wrapper "testglue.o"];
59
        if { $result != "" } {
60
            set wrapper_file [lindex $result 0];
61
            set wrap_compile_flags [lindex $result 1];
62
        } else {
63
            warning "Status wrapper failed to build."
64
        }
65
    }
66
 
67
    set java_initialized 1
68
}
69
 
70
#
71
# Run the test specified by srcfile and resultfile. compile_args and
72
# exec_args are options telling this proc how to work.
73
#
74
proc compile_java_from_source { srcfile binfile compile_args } {
75
    global GCJ_UNDER_TEST
76
    global runtests
77
    global java_initialized
78
 
79
    if { $java_initialized != 1 } { java_init }
80
 
81
    set errname [file rootname [file tail $srcfile]]
82
    if {! [runtest_file_p $runtests $errname]} {
83
        return
84
    }
85
 
86
    set args "compiler=$GCJ_UNDER_TEST"
87
    lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
88
    if { $compile_args != "" } {
89
        lappend args "additional_flags=$compile_args"
90
    }
91
 
92
    if { $compile_args != "" } {
93
        set errname "$errname $compile_args"
94
    }
95
 
96
    set x [target_compile $srcfile ${binfile} ${binfile} $args]
97
    if { $x != "" } {
98
        verbose "target_compile failed: $x" 2
99
        return "$errname compilation from source";
100
    }
101
}
102
 
103
# Local Variables:
104
# tcl-indent-level:4
105
# End:

powered by: WebSVN 2.1.0

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