Hi,
I've taken care of some, maybe all, of the observations :

https://git.enlightenment.org/core/efl.git/tree/mtests.sh?h=devs/jeyzu/mtests
https://git.enlightenment.org/core/efl.git/tree/src/lib/eina/tests?h=devs/jeyzu/mtests
https://git.enlightenment.org/core/efl.git/tree/src/tests/test_macros.h?h=devs/jeyzu/mtests

colorized : http://cgit.asynk.ch/bin/tree/mtests.sh


p.s.
  sorry Raster for the noise,
  I just realized that I was answering to you instead of the ML :|


On Saturday 17 December 2016  11:55, Jérémy Zurcher wrote :
> <snip snip>
> 
> Hi,
> I wrote a quick and dirty POC ...
> comments welcome
> 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> #! /bin/sh
> 
> SRC_D=src
> BUILD_D=src
> CONFIG_SH=config.sh
> INIT_C=init.c
> SHUTDOWN_C=shutdown.c
> C_FILE=/tmp/__efl_test.c
> O_FILE=/tmp/__efl_test.o
> DEBUG=0
> 
> SCRIPT_DIR=${0%/*}
> SCRIPT_FILE=${0##*/}
> 
> CC=${CC:-"clang"}
> LD=""
> INCLUDE=""
> 
> function fatal {
>    echo "FATAL $1"
>    exit 1
> }
> 
> while [ $# -ge 1 ]; do
>     case "$1" in
>         -s*|--src*)
>             shift
>             [ $# -lt 1 ] && fatal "option -s is missing directory argument"
>             SRC_D=$1
>             shift
>             ;;
>         -b*|--build*)
>             shift
>             [ $# -lt 1 ] && fatal "option -b is missing directory argument"
>             BUILD_D=$1
>             shift
>             ;;
> 
>         -h|--help)
>             echo "Usage:  $SCRIPT_FILE [options]"
>             echo
>             echo "Options:"
>             echo "    -s, --src directory    Directory to search tests into"
>             echo "    -b, --build directory  Directory to search built files 
> into"
>             echo "    -h, --help             This message."
>             exit 0
>             ;;
> 
>         *)
>             break
>     esac
> done
> 
> SRC_D=$(readlink -f $SRC_D)
> BUILD_D=$(readlink -f $BUILD_D)
> 
> [ -d "$SRC_D" -a -r "$SRC_D" ] || fatal "$SRC_D is not a valid directory"
> [ -d "$BUILD_D" -a -r "$BUILD_D" ] || fatal "$BUILD_D is not a valid 
> directory"
> 
> function load_cfg {
>    unset LDS
>    unset INCLUDES
>    LDF=""
>    LDP=""
>    INCLUDE="-I .."
>    if [ -f $CONFIG_SH -a -r $CONFIG_SH ]
>    then
>       echo "    load $CONFIG_SH"
>       source ./$CONFIG_SH
>       for include in $INCLUDES
>       do
>          F=$(find $SRC_D -name $include)
>          if [ -z "$F" ]
>          then
>             F=$(find $BUILD_D -name $include)
>             [ ! -z "$F" ] || fatal "can't find $include in $SRC_D or $BUILD_D"
>          fi
>          INCLUDE="$INCLUDE -I ${F%/*}"
>       done
>       for ld in $LDS
>       do
>          F=$(find $BUILD_D -name $ld)
>          [ ! -z "$F" ] || fatal "can't find $ld in $BUILD_D"
>          F=$(readlink -f $F)
>          LDP="$LDP -L ${F%/*}"
>          lib=${F##*/lib}
>          lib=${lib%.so*}
>          LDF="$LDF -l$lib"
>       done
>    fi
> }
> 
> echo "search for tests into $SRC_D"
> for dir in $(find $SRC_D -type d -name tests)
> do
>    echo "  enter $dir"
>    pushd $dir > /dev/null || fatal "cannot enter $dir"
>    [ -f $INIT_C -a -r $INIT_C ] || fatal "missing mandatory file $INIT_C"
>    [ -f $SHUTDOWN_C -a -r $SHUTDOWN_C ] || fatal "missing mandatory file 
> $SHUTDOWN_C"
>    load_cfg
>    for test_c in $(ls -1 test_*.c)
>    do
>       echo -n "    compile and run $test_c"
>       cat $INIT_C $test_c $SHUTDOWN_C > $C_FILE
>       CMD="$CC $INCLUDE $LDP $LDF -o $C_FILE.o $O_FILE"
>       [ $DEBUG -eq 1 ] && echo "$CMD"
>       $CMD || fatal "compilation failed"
>       $O_FILE.o && echo " PASS" || fatal "test run failed"
>    done
>    echo "  leave"
>    popd > /dev/null
> done
> echo "done"
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> 
> 
> this is what I've got in src/lib/eina/tests
> 
> jeyzu@bigdaddy: tests (master) $ cat config.sh
> INCLUDES="eina_config.h Eina.h Efl_Config.h"
> LDS="libeina.so"
> 
> jeyzu@bigdaddy: tests (master) $ cat init.c
> #include <Eina.h>
> 
> #define FAIL_IF(_x) if ((_x)) { fprintf(stderr, "fail\n"); exit(1); }
> 
> int main(int argc, char *argv[])
> {
>    eina_init();
> 
> jeyzu@bigdaddy: tests (master) $ cat shutdown.c
>   eina_shutdown();
>   return 0;
> }
> 
> jeyzu@bigdaddy: tests (master) $ cat test_list_append.c
> Eina_List *list = NULL;
> list = eina_list_append(list, (void *)123L);
> FAIL_IF(eina_list_data_find_list(list, (void *)123L) != list);
> 
> 
> run from topdir
> jeyzu@bigdaddy: efl (master) $ ./tests.sh -s src/lib/eina -b build
> search for tests into /home/jeyzu/usr/git/efl/core/efl/src/lib/eina
>   enter /home/jeyzu/usr/git/efl/core/efl/src/lib/eina/tests
>     load config.sh
>     compile and run test_list_append.c PASS
>   leave
> done
> 
> 
> --- Hell'O from Yverdoom
> 
> Jérémy (jeyzu)
--- Hell'O from Yverdoom

Jérémy (jeyzu)

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to