Skip to content

Commit

Permalink
run_artery.sh: support opp_runall as an option
Browse files Browse the repository at this point in the history
If arguments -j and/or -b are provided, opp_runall is called instead of opp_run.
Pass --all to use opp_runall without specifying any values for -j or -b.

For details, see https://doc.omnetpp.org/omnetpp/manual/#sec:run-sim:batches-using-opp-runall
  • Loading branch information
marecabo authored and riebl committed May 25, 2021
1 parent ee6d530 commit 42ac46c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmake/AddOppRun.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ function(generate_run_script)
else()
set(opp_run_executable ${OMNETPP_RUN})
endif()
set(opp_runall_script ${OMNETPP_RUNALL})

# substitute variables first, then generator expressions
configure_file(${PROJECT_SOURCE_DIR}/cmake/run_artery.sh.in ${args_FILE} @ONLY)
Expand Down
1 change: 1 addition & 0 deletions cmake/FindOmnetPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ find_path(OMNETPP_ROOT NAMES bin/omnetpp PATHS ENV PATH PATH_SUFFIXES .. DOC "Pa
find_path(OMNETPP_INCLUDE_DIR NAMES omnetpp.h PATHS ${OMNETPP_ROOT}/include DOC "OMNeT++ include directory")
find_program(OMNETPP_MSGC NAMES nedtool opp_msgc PATHS ${OMNETPP_ROOT}/bin DOC "OMNeT++ message compiler")
find_program(OMNETPP_RUN NAMES opp_run_release opp_run PATHS ${OMNETPP_ROOT}/bin DOC "OMNeT++ opp_run executable")
find_program(OMNETPP_RUNALL NAMES opp_runall PATHS ${OMNETPP_ROOT}/bin DOC "OMNeT++ opp_runall script")
find_program(OMNETPP_RUN_DEBUG NAMES opp_run_dbg opp_run PATHS ${OMNETPP_ROOT}/bin DOC "OMNeT++ opp_run_dbg executable")
get_filename_component(OMNETPP_ROOT "${OMNETPP_ROOT}" REALPATH)
mark_as_advanced(OMNETPP_INCLUDE_DIR OMNETPP_MSGC OMNETPP_ROOT OMNETPP_RUN OMNETPP_RUN_DEBUG)
Expand Down
17 changes: 16 additions & 1 deletion cmake/run_artery.sh.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#!/bin/bash
OPP_RUNALL=@opp_runall_script@
OPP_RUN=@opp_run_executable@
NED_FOLDERS="@opp_run_ned_folders@"
LIBRARIES="@opp_run_libraries@"

$OPP_RUN -n $NED_FOLDERS $LIBRARIES $@
RUNALL=false
for arg do
shift
[[ "$arg" == -j* ]] && RUNALL=true && J=$arg && continue
[[ "$arg" == -b* ]] && RUNALL=true && B=$arg && continue
# run opp_runall with default values for -j* and -b* options by just specifying '--all'
[[ "$arg" == "--all" ]] && RUNALL=true && continue
set -- "$@" "$arg"
done

if [ "$RUNALL" = true ] ; then
$OPP_RUNALL $J $B $OPP_RUN -n $NED_FOLDERS $LIBRARIES $@
else
$OPP_RUN -n $NED_FOLDERS $LIBRARIES $@
fi

0 comments on commit 42ac46c

Please sign in to comment.