testAllExamples.sh

#1

As a first post: a better “testAllExamples.sh” script for Linux (and probably OSX). My version checks if the example binaries are already compiled in order to avoid recompiling them, so it’s a better companion to the script “buildAllExamples.sh”

#!/bin/bash

export LC_ALL=C
cd ../../examples

for folder in $( find . -maxdepth 1 -type d ! -path . | sort -n )
do
    category=${folder#./}
    if [ "$category" = "android" -o "$category" = "ios" -o "$category" = "gles" ]; then
            continue
    fi
    cd $category
    for subfolder in $( find . -maxdepth 1 -type d ! -path . | sort -n )
    do
        example=${subfolder#./}
        if [[ "$example" == osx* ]]
        then
            continue
        fi
        cd $example
        if [ ! -f "bin/${example}" ]; then
            echo "-----------------------------------------------------------------"
            echo "building " + $example
            cd $example
            make -j Debug
            ret=$?
            if [ $ret -ne 0 ]; then
              echo error compiling $example
              exit
            fi
            make -j Release
            ret=$?
            if [ $ret -ne 0 ]; then
              echo error compiling $example
              exit
            fi
        fi
        cd bin
        ./$example
        cd ../..
        echo "-----------------------------------------------------------------"
        echo ""
    done
    cd ..
done

Marc