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 0db81a8545
commit 04697b8099
2 changed files with 15 additions and 4 deletions

View File

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