2011-07-05 09:18:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-07-11 09:40:23 +00:00
|
|
|
# Copyright 2011 George Danchev <danchev@spnet.net>
|
2011-07-15 06:05:57 +00:00
|
|
|
# Licensed under GNU GPL version 2 or later
|
2011-07-11 09:40:23 +00:00
|
|
|
|
2011-07-05 09:18:31 +00:00
|
|
|
set -e
|
|
|
|
|
2011-07-13 11:24:32 +00:00
|
|
|
not_in_releng_exit() {
|
|
|
|
printf "\nPlease execute the tests from releng directory.\n\n"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
. inc/releng_getopts.inc || not_in_releng_exit
|
2011-07-05 09:18:31 +00:00
|
|
|
|
2011-07-20 12:23:40 +00:00
|
|
|
print_specific_help() {
|
|
|
|
cat << HLP
|
|
|
|
Specific options:
|
|
|
|
none yet.
|
|
|
|
Overview:
|
|
|
|
Tests both xorriso/xorriso.h and libisoburn/libisoburn.h
|
|
|
|
APIs for C++ cleanness.
|
|
|
|
HLP
|
|
|
|
}
|
2011-07-18 17:22:59 +00:00
|
|
|
|
|
|
|
if test "$SPECIFIC_HELP" = 1; then
|
2011-07-20 12:23:40 +00:00
|
|
|
print_specific_help
|
2011-07-18 17:22:59 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
2011-07-05 09:18:31 +00:00
|
|
|
|
2011-07-18 17:22:59 +00:00
|
|
|
# xorriso binary is not needed for that particular test
|
2011-07-08 12:16:44 +00:00
|
|
|
SAMPLE_CODE_DIR=codesamples
|
|
|
|
CC=g++
|
2011-07-05 09:18:31 +00:00
|
|
|
|
2011-07-19 16:51:51 +00:00
|
|
|
# check compiler
|
|
|
|
if ! which "${CC}" >/dev/null 2>&1; then
|
|
|
|
printf "\n${SELF}: Not found: ${CC}. Install ${CC}.\n"
|
|
|
|
cleanup
|
|
|
|
exit 5
|
|
|
|
fi
|
|
|
|
|
2011-07-05 09:18:31 +00:00
|
|
|
# check data dir
|
|
|
|
if [ -d "${GEN_DATA_DIR}" ]; then
|
|
|
|
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
|
2011-07-15 18:07:02 +00:00
|
|
|
printf "\n${SELF}: use '${SELF} -c' to remove.\n"
|
2011-07-19 16:51:51 +00:00
|
|
|
exit 6
|
2011-07-05 09:18:31 +00:00
|
|
|
else
|
|
|
|
mkdir "${GEN_DATA_DIR}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# process sample code tests
|
|
|
|
for SMPL in `ls "${SAMPLE_CODE_DIR}"/*.cpp`; do
|
2012-04-21 09:14:14 +00:00
|
|
|
# CMD_CPL="${CC} -I../ -L ../libisoburn/.libs/ ${CFLAGS} -lisoburn -o ${SMPL}.obj ${SMPL}"
|
2012-04-21 11:09:30 +00:00
|
|
|
CMD_CPL="${CC} -c -I../ -I../../libburn -I../../libisofs ${CFLAGS} -o ${SMPL}.obj ${SMPL}"
|
2012-04-21 09:14:14 +00:00
|
|
|
printf "${SELF}: ${CMD_CPL}"
|
2011-07-05 10:27:27 +00:00
|
|
|
set +e
|
2011-07-05 09:18:31 +00:00
|
|
|
${CMD_CPL}
|
2011-07-05 10:27:27 +00:00
|
|
|
RET_CPL="$?"
|
2011-08-09 17:25:39 +00:00
|
|
|
if [ ${RET_CPL} = 0 -a -f ${SMPL}.obj ]; then
|
2011-07-05 10:27:27 +00:00
|
|
|
mv ${SMPL}.obj ${GEN_DATA_DIR}
|
2012-04-21 09:14:14 +00:00
|
|
|
printf "...ok\n"
|
2011-07-05 10:27:27 +00:00
|
|
|
else
|
2011-08-05 15:43:58 +00:00
|
|
|
printf "\nFAIL : ${SELF}: Compilation of ${SMPL}\n"
|
2011-07-05 10:27:27 +00:00
|
|
|
cleanup
|
|
|
|
exit 7
|
|
|
|
fi
|
2012-04-21 09:14:14 +00:00
|
|
|
# BASE=$(basename ${SMPL}.obj)
|
|
|
|
# printf "${SELF}: Running LD_LIBRARY_PATH=../libisoburn/.libs/:${LD_LIBRARY_PATH} ${GEN_DATA_DIR}/${BASE}"
|
|
|
|
# LD_LIBRARY_PATH=../libisoburn/.libs/:${LD_LIBRARY_PATH} ${GEN_DATA_DIR}/${BASE}
|
|
|
|
# RET_SMPL="$?"
|
|
|
|
# case ${RET_SMPL} in
|
|
|
|
# 0)
|
|
|
|
# printf "...ok\n"
|
|
|
|
# ;;
|
|
|
|
# *)
|
|
|
|
# printf "exit code: ${RET_SMPL}\n"
|
|
|
|
# cleanup
|
|
|
|
# exit 8
|
|
|
|
# ;;
|
|
|
|
# esac
|
2011-07-05 10:27:27 +00:00
|
|
|
set -e
|
2011-07-05 09:18:31 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# clean
|
|
|
|
cleanup
|
|
|
|
|
|
|
|
exit 0
|