#!/bin/bash

TEST_ROOT=/tmp/libisofs_test

rm -rf $TEST_ROOT

#create test folders
mkdir -p $TEST_ROOT
mkdir -p $TEST_ROOT/dir1/dir11
chmod 755 $TEST_ROOT/dir1
chmod 755 $TEST_ROOT/dir1/dir11

touch $TEST_ROOT/dir1/dir11/a
echo "This file is to check correct file permissions. set them to 754" > $TEST_ROOT/dir1/permtest
chmod 754 $TEST_ROOT/dir1/permtest

mkdir -p $TEST_ROOT/dir2
ln -s $TEST_ROOT/dir1 "$TEST_ROOT/link to dir1"

echo "README file" >  $TEST_ROOT/README
chmod 555 $TEST_ROOT/README
ln -s $TEST_ROOT/README "$TEST_ROOT/link to readme"

echo "No read file" > $TEST_ROOT/no_read
chmod 000 $TEST_ROOT/no_read

if ! make check
then
	exit 1
fi

test/test