#! /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 CondorUtils;
use Check::SimpleJob;

$testname = "job_filexfer_basic_van";
my $pid = $$;

my $return = "submit_transferfile_vanilla$pid.txtdata";

$success = sub {
	open(SENT,    "<job_filexfer_basic.data")|| die "Can't open job_filexfer_basic.data: $!\n";
	open(GOTBACK, "<$return") || die "Can't open $return: $!\n";
	local $/;
	my $sent = <SENT>;
	my $got  = <GOTBACK>;
	close SENT;
	close GOTBACK;
	if($sent ne $got) {
		die "Data was not preserved between file transfers\n";
	}
};

SimpleJob::RunCheck(
    runthis=>"x_copy_binary_file.pl",
    duration=>"job_filexfer_basic.data $return",
    transfer_output_files=>"$return",
	transfer_input_files=>"job_filexfer_basic.data",
    should_transfer_files=>"YES",
    when_to_transfer_output=>"ON_EXIT",
    on_success=>$success,
);

CondorTest::EndTest();
print scalar localtime() . "\n";

if( $result != 0 )
{
    exit(1);
}

CondorTest::debug("$testname SUCCESS\n",1);
exit(0);


