#!/usr/bin/env perl
#testreq: personal
##**************************************************************
##
## Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
## University of Wisconsin-Madison, WI.
## 
## Licensed under the Apache License, Version 2.0 (the "License"); you
## may not use this file except in compliance with the License.  You may
## obtain a copy of the License at
## 
##    http://www.apache.org/licenses/LICENSE-2.0
## 
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##**************************************************************


use CondorTest;
use File::Path;
use strict;
use warnings;

my $cmd = 'job_core_bigenv_van.cmd';
my $testdesc =  'bigenv (vanilla) Test';
my $testname = "job_core_bigenv_van";

umask 0;

my $OutputTest = sub
{
    my %info = @_;
	my $last;

	print "Job ended, checking results - ";
    my $output = $info{"output"};
    open( OUTPUT, "<$output" ) || die "Can't open $output: $!\n";
    while( <OUTPUT> ) {
    	$last = $_;
    }
    $last =~ /(.*)SUCCESS(.*)/ ||
    die "$testname: FAILURE (bad output to STDOUT)\n";

    -z $info{"error"} ||
    die "$testname: FAILURE (STDERR contains data)\n";
	print "ok\n";
};

CondorTest::RegisterExitedSuccess( $testname, $OutputTest);

if( CondorTest::RunTest($testname, $cmd, 0) ) {
    CondorTest::debug("$testname: SUCCESS\n",2);
    exit(0);
} else {
    die "$testname: CondorTest::RunTest() failed\n";
}

