run.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/env bash
  2. MAKE_OPTS=${MAKE_OPTS:-""}
  3. RUNON=${RUNON-fpga}
  4. CONFIG=${CONFIG-"n900,ux900"}
  5. RUNYAML=${RUNYAML-}
  6. BACKUP=${BACKUP:-Backups}
  7. CFGSET=${CFGSET:-mini}
  8. BITSET=${BITSET:-latest}
  9. RUNMODE=${RUNMODE-all}
  10. VERBOSE=${VERBOSE-}
  11. MYSCRIPTDIR=$(dirname $(readlink -f $BASH_SOURCE))
  12. MYSCRIPTDIR=$(readlink -f $MYSCRIPTDIR)
  13. COMMON_ENV=$(readlink -f $MYSCRIPTDIR/../env.sh)
  14. FPGALOC=
  15. CFGLOC=
  16. if [ "x$RUNYAML" != "x" ] ; then
  17. RUNYAML=$(readlink -f $RUNYAML)
  18. if [ ! -f $RUNYAML ] ; then
  19. echo "$RUNYAML not exist, please check!"
  20. exit 1
  21. fi
  22. fi
  23. source $COMMON_ENV
  24. gen_logdir bareapp
  25. describe_env
  26. function setup_suite {
  27. local cfgloc=${1:-mini}
  28. local fpgaloc=${2:-latest}
  29. local configpath=${MYSCRIPTDIR}/configs/${cfgloc}
  30. local fpgapath=${MYSCRIPTDIR}/bitstreams/$fpgaloc
  31. if [ ! -d $configpath ] ; then
  32. echo "Can't find proper test suite $cfgloc located in $configpath"
  33. echo "Please pass correct CFGSET value, such as CFGSET=mini or CFGSET=full"
  34. exit 1
  35. fi
  36. if [ ! -d $fpgapath ] ; then
  37. echo "Can't find proper test suite $fpgaloc located in $fpgapath"
  38. echo "Please pass correct FPGASET value, such as FPGASET=latest or FPGASET=202206"
  39. exit 1
  40. fi
  41. CFGLOC=$configpath
  42. FPGALOC=$fpgapath
  43. }
  44. function runbench {
  45. local yfn=$1
  46. local logdir=$2
  47. local mkoptions=${@:3}
  48. local RUNNER_CMD="python3 $NSDK_RUNNER_PY --appyaml ${MYSCRIPTDIR}/$yfn.yaml --logdir $LOGDIR/$logdir --runon $RUNON --cfgloc $CFGLOC --fpgaloc $FPGALOC"
  49. if [ "x$RUNYAML" != "x" ] ; then
  50. RUNNER_CMD="${RUNNER_CMD} --runyaml $RUNYAML"
  51. fi
  52. if [ "x$CONFIG" != "x" ] ; then
  53. RUNNER_CMD="${RUNNER_CMD} --config \"$CONFIG\""
  54. fi
  55. if [ "x$VERBOSE" == "x1" ] ; then
  56. RUNNER_CMD="${RUNNER_CMD} --verbose"
  57. fi
  58. if [ "x$mkoptions" != "x" ] ; then
  59. RUNNER_CMD="${RUNNER_CMD} --make_options \"$mkoptions\""
  60. fi
  61. echo $RUNNER_CMD
  62. if [[ $DRYRUN == 0 ]] ; then
  63. export OLDRUNMODE=$RUNMODE
  64. unset RUNMODE
  65. eval $RUNNER_CMD
  66. export RUNMODE=$OLDRUNMODE
  67. unset OLDRUNMODE
  68. fi
  69. }
  70. function do_bareapp {
  71. pushd $NSDK_ROOT
  72. if [ "x${RUNMODE}" == "xall" ] || [ "x${RUNMODE}" == "xbare" ] ; then
  73. echo "Run all baremetal applications for all cores"
  74. runbench bareapp bareapp ""
  75. fi
  76. if [ "x${RUNMODE}" == "xall" ] || [ "x${RUNMODE}" == "xclib" ] ; then
  77. echo "Run all baremetal applications using libncrt for all cores"
  78. runbench clibapp clibapp ""
  79. fi
  80. # generate report for all modes
  81. RUNCMD="python3 $NSDK_REPORT_PY --logdir $LOGDIR --split --run"
  82. if [[ $DRYRUN == 0 ]] ; then
  83. eval $RUNCMD
  84. fi
  85. popd
  86. }
  87. setup_suite ${CFGSET} ${FPGASET}
  88. do_bareapp | tee $LOGDIR/build.log
  89. zip_logdir