Blob Blame History Raw
# Copyright (C) 1992-2016 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# DejaGnu is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DejaGnu; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.

# This file was written by Rob Savoye <rob@welcomehome.org>.

load_lib util-defs.exp

# move the site.exp file so we have no default to confuse us.
#if [file exists $objdir/site.exp] {
#    catch "exec mv -f $objdir/site.exp $objdir/site.ignore"
#}
set fd [open site.exp w]
puts ${fd} "set host_triplet $host_triplet"
puts ${fd} "set srcdir $srcdir/.."
puts ${fd} "set objdir $objdir/.."
puts ${fd} "set tmpdir $objdir/../tmpdir"
close $fd

#
# Set up the list.
# 1st field is the command line option.
# 2nd field is the pattern to match.
#	NOTE - No variable substitutions can be used.
# 3rd field is an optional message to print with PASS/FAIL.
#


set tests {
    { "-v --tool xXx" "Found.*site\..*Loading.*utils\.exp" "Loading library files" }
    { "-v --tool xXx" "Expect binary is.*Using.*main test driver" "Loading basic packages" }
    { "--F --tool x" "Illegal Argument \"--F\"" "Bad argument" }
    { "--tool x" "Couldn't find tool init file" "Bad tool name" }
    { "--help" "USAGE:*" "Display help" }
    { "-v -v -v" "Verbose level is 3" "Verbose set correctly" }
    { "-v --target m68k-vxworks" "Target is m68k-vxworks" "--target option" }
    { "-v --target_board flash" "Running target flash" "--target_board option" }
    { "-v --host sparc-sun-sunos4.1.9" "Native configuration is sparc-sun-sunos4.1.9" "--host option" }
    { "-v -a" "Print all test output to screen" "--all option" }
    { "-v --all" "Print all test output to screen" "--all option" }
    { "-v --ignore foo.exp" "Ignoring test foo.exp" "--ignore option" }
    { "-v --objdir xXx" "Using test binaries in xXx" "--objdir option" }
    { "-v --tool xXx" "Testing xXx" "--tool option" }
    { "-v --debug" "Expect Debugging is ON" "--debug option" }
    { "-v --reboot" "Will reboot the target" "--reboot option" }
    { "-v --strace 1" "Source Trace level is now 1.* 1  if" "--strace option" }
    { "-v --D0" "Tcl debugger is ON" "--D0 option" }
    { "-V" "DejaGnu version.*Expect version.*Tcl version.*" "-V option" }
    { "--version" "DejaGnu version.*Expect version.*Tcl version.*" "--version option" }
    { "-v --xml" "XML logging turned on" "--xml option" }
}

foreach t $tests {
    if [util_test "$RUNTEST" "[lindex $t 0] -srcdir ${srcdir}/runtest.all" "" "[lindex $t 1]"] {
        fail "[lindex $t 2]"
    } else {
        pass "[lindex $t 2]"
    }
}


set fd [open site.exp w]
puts ${fd} "set host_triplet $host_triplet"
puts ${fd} "set srcdir $srcdir"
puts ${fd} "set objdir $objdir"
puts ${fd} "set tmpdir $objdir/tmpdir"
close $fd

# clean up log files left by the child runtest
foreach f [concat [glob $objdir/x.*] [glob $objdir/xXx.*]] {
    file delete $f
}
file delete dbg.log