#!/bin/sh

. ./test-functions

echo -n "Tainted program file test:		"
# Create file now; creating after taint would taint parent directory.
dir=$(mktemp -d sft-XXXXXX)
conf_copy=$(mktemp -u $dir/sft-XXXXXX.c)
conf_copy2=$(mktemp -u $dir/sft-XXXXXX)
( # Sub-shell so as not to taint the test process.
	cp confidential $conf_copy
	cat > $conf_copy <<EOF
#include <stdio.h>

int main (int argc, char *argv[])
{
	return 0;
}
EOF
	TMPDIR=$dir gcc $conf_copy -o $conf_copy2
)
test_taint_logged ./$conf_copy2
rm -rf $dir
