
. ./inits

tests="$(find -name "*.oc")"

for file in ${tests}; do
	OFLAGS="x_file 1 nul_res_pref 1 includedir 0 relative_path 1"
	#includedir 0 relative_path 1   to test on launchpad at <<PKGBUILDDIR>> that is not the real folder there. and ounused is also working with this

	echo ${file} | grep "\.w" > /dev/null
	if [ $? = 0 ]; then OFLAGS="${OFLAGS} inplace_reloc 0 conv_64 2"; fi
	echo ${OCOMP} ${file} ${OFLAGS}
	LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${OCOMP} ${file} ${OFLAGS} || exit 1
done

${launcher} ../otoc/otoc a.out.oc.x import && {
	cc a.out.c -o cc -Wno-int-conversion -Wno-incompatible-pointer-types || { #-Wno are a must at pkgbuild
		if [ ! -e ../NOOCONVTEST ]; then
			echo cc test result is wrong
			exit 1
		else
			echo cc test result was disabled
		fi
	}
}
