X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=misc%2Fcheck-proj.sh;h=bcdc0b7a93d0cd603bd91fbca0e4c4792d27061e;hp=2d94667534761b430335e184b872381dceeb4732;hb=d664b9f6076ab1a8b8357e918f7a04ff8a0a029a;hpb=6a235dc25fcd1adff69603374016530b321e6a16 diff --git a/misc/check-proj.sh b/misc/check-proj.sh index 2d94667..bcdc0b7 100755 --- a/misc/check-proj.sh +++ b/misc/check-proj.sh @@ -12,7 +12,7 @@ download_hashes=$(wget -qO- ${hashes}) download_options=$(wget -qO- ${options}) download() { - pushd ~/.gmqcc/testsuite >> /dev/null + pushd ~/.gmqcc/testsuite > /dev/null echo "$download_list" | while read -r line do echo "downloading $line ..." @@ -22,7 +22,7 @@ download() { echo "$download_hashes" > ~/.gmqcc/testsuite/hashes echo "$download_options" > ~/.gmqcc/testsuite/options - popd >> /dev/null + popd > /dev/null } if [ -z "$download_list" -o -z "$download_hashes" -o -z "$download_options" ]; then @@ -44,9 +44,9 @@ if [ -f ~/.gmqcc/testsuite/hashes -a -f ~/.gmqcc/testsuite/options ]; then echo "$download_hashes" > /tmp/gmqcc_download_hashes echo "$download_options" > /tmp/gmqcc_download_options - diff -u ~/.gmqcc/testsuite/hashes /tmp/gmqcc_download_hashes >> /dev/null + diff -u ~/.gmqcc/testsuite/hashes /tmp/gmqcc_download_hashes > /dev/null check_hash=$? - diff -u ~/.gmqcc/testsuite/options /tmp/gmqcc_download_options >> /dev/null + diff -u ~/.gmqcc/testsuite/options /tmp/gmqcc_download_options > /dev/null check_opts=$? if [ $check_hash -ne 0 -o $check_opts -ne 0 ]; then @@ -68,14 +68,14 @@ fi if [ ! -d ~/.gmqcc/testsuite/projects ]; then mkdir -p ~/.gmqcc/testsuite/projects - pushd ~/.gmqcc/testsuite/projects >> /dev/null - echo "$(ls ../ | cat | grep -v '^hashes$' | grep -v '^projects$')" | while read -r line + pushd ~/.gmqcc/testsuite/projects > /dev/null + echo "$(ls ../ | cat | grep -v '^hashes$' | grep -v '^projects$' | grep -v '^options$')" | while read -r line do echo "extracting project $line" mkdir "$(echo "$line" | sed 's/\(.*\)\..*/\1/')" unzip -qq "../$line" -d $(echo "$line" | sed 's/\(.*\)\..*/\1/') done - popd >> /dev/null + popd > /dev/null else echo "previous state exists, using it" fi @@ -96,18 +96,38 @@ env -i type gmqcc 1>/dev/null 2>&1 || { fi } -pushd ~/.gmqcc/testsuite/projects >> /dev/null +pushd ~/.gmqcc/testsuite/projects > /dev/null find . -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | while read -r line do echo -n "compiling $line... " - pushd "$line" >> /dev/null - "$gmqcc_bin" $(cat ../../options | grep "$line:" | awk '{print $2}') > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "error" + pushd "$line" > /dev/null + + # does the project have multiple subprojects? + if [ -f dirs ]; then + echo "" + cat dirs | while read -r dir + do + # change to subproject + echo -n " compiling $dir... " + pushd "$dir" > /dev/null + "$gmqcc_bin" $(cat ../../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}') > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "error" + else + echo "success" + fi + popd > /dev/null + done + # nope only one project else - echo "success" + "$gmqcc_bin" $(cat ../../options | grep "$line:" | awk '{print substr($0, index($0, $2))}') > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "error" + else + echo "success" + fi fi - - popd >> /dev/null + popd > /dev/null done -popd >> /dev/null + +popd > /dev/null