move first code sample in target directory, and use that as well

This commit is contained in:
George Danchev 2011-07-05 10:27:27 +00:00
parent 6092c62459
commit ef8c267fd0
2 changed files with 15 additions and 4 deletions

View File

@ -6,7 +6,7 @@ START_DIR_DONT_CHANGE=`pwd`
SELF=$(basename "$0")
GEN_DATA_DIR=releng_generated_data/${SELF}
KEEP=0
SAMPLE_CODE_DIR=releng_generated_data
SAMPLE_CODE_DIR=codesamples
CC=g++
CC_FLAFS=" -I ../libisoburn -L ../libisoburn/.libs/ -lisoburn "
@ -82,9 +82,19 @@ if test -f "${SAMPLE_CODE_DIR}"/*.cpp; then
for SMPL in `ls "${SAMPLE_CODE_DIR}"/*.cpp`; do
CMD_CPL="${CC} ${CC_FLAGS} -o ${SMPL}.obj ${SMPL}"
printf "\n${SELF}: ${CMD_CPL}\n"
set +e
${CMD_CPL}
printf "${SELF}: Running ./${SMPL}.obj"
./${SMPL}.obj
RET_CPL="$?"
if [ ${RET_CPL} == 0 -a -f ${SMPL}.obj ]; then
mv ${SMPL}.obj ${GEN_DATA_DIR}
else
printf "\n${SELF}: FAIL Compilation of ${SMPL}\n"
cleanup
exit 7
fi
BASE=$(basename ${SMPL}.obj)
printf "${SELF}: Running ${GEN_DATA_DIR}/${BASE}"
${GEN_DATA_DIR}/${BASE}
RET_SMPL="$?"
case ${RET_SMPL} in
0)
@ -93,9 +103,10 @@ if test -f "${SAMPLE_CODE_DIR}"/*.cpp; then
*)
printf "exit code: ${RET_SMPL}\n"
cleanup
exit 7
exit 8
;;
esac
set -e
done
else
printf "\n${SELF}: No C++ code samples found in ${SAMPLE_CODE_DIR}\n"