Commit 61bb9f20 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'main' into ci/restrict-osba-complexity-runs-to-hoa3

parents cfd3b03a 4a4bb894
Loading
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -28,15 +28,27 @@
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# the United Nations Convention on Contracts on the International Sales of Goods.

# get format from command line
if [ $# -ne 2 ]; then
  echo "Usage: $0 \"ivas-format(s)\" \"output-format(s)\""
function usage {
    echo "Usage: $0 \"ivas-format(s)\" \"output-format(s)\" \"mode{full(default)|mem_only}\""
  exit 1
}

if [ $# -ne 2 ] && [ $# -ne 3 ]; then
    usage
fi

ivas_format=$1
output_format="$2"

mode_arg_script=""
if [ $# -eq 3 ]; then
    if [ "$3" = "mem_only" ]; then
        mode_arg_script="--wmc_tool_mem_only"
    elif [ "$3" != "full" ]; then
        usage
    fi
fi

date=`date +%Y%m%d`                         # used for log-file file ending
shortDate=`date "+%b %d" | sed -e "s/\ /_/g"`    # stored in the log-file
fullDate=`date "+%c" | sed -e "s/\ /_/g"`       # stored in the log-file
@@ -63,7 +75,7 @@ if [ "$ivas_format" == "OSBA" ]; then
fi

# instrument and build
./scripts/IvasBuildAndRunChecks.py -p $config_file --checks COMPLEXITY --create_complexity_tables ${wmopsFilenameFlc} -C $ivas_format $mode_arg -f ${ep} --oc $output_format
./scripts/IvasBuildAndRunChecks.py $mode_arg_script -p $config_file --checks COMPLEXITY --create_complexity_tables ${wmopsFilenameFlc} -C $ivas_format $mode_arg -f ${ep} --oc $output_format
ret_val=$?

# get the info on worst-case operating point: WMOPS number, enc-operating mode, dec-operating mode
+6 −0
Original line number Diff line number Diff line
@@ -95,6 +95,11 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript):
            help="suppression file for undef behaviour sanitizer",
            default=None,
        )
        self.parser.add_argument(
            "--wmc_tool_mem_only",
            help="pass the '-s' argument to the wmc tool to only measure memory",
            action="store_true",
        )

    def run(self):

@@ -159,6 +164,7 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript):
                    format_select_list=modes,
                    formats_fname=self.args["format_file"],
                    max_workers=self.args["max_workers"],
                    mem_only=self.args["wmc_tool_mem_only"],
                )
            else:
                br.add_check(
+40 −33
Original line number Diff line number Diff line
@@ -35,12 +35,26 @@ function usage {
    echo "Usage:"
    echo "      prepare_instrumentation.sh [MODE]"
    echo 
    echo "      MODE - sr_off (default) or sr_on"
    echo "      MODE - full (default) or mem_only"
    exit
}

INCLUDE_SPLIT=1

wmc_opt=""
if [ $# -eq 1 ]; then
    mode=$1
    if [ "$mode" = "full" ]; then
        wmc_opt=""
    elif [ "$mode" = "mem_only" ]; then
        wmc_opt="-s"
    else
        echo "Invalid input for MODE"
        usage
        exit 1
    fi
elif [ $# -ge 2 ]; then
    usage
    exit 1
fi

system=`uname -s`
if [[ ($system == "Linux") && (`uname -a` =~ (microsoft|Microsoft|wsl|WSL) ) ]]; then
@@ -79,16 +93,12 @@ cp -R ../apps $targetdir
cp -R ../Makefile $targetdir
cp -R ../CMakeLists.txt $targetdir
cp -R ../Workspace_msvc $targetdir
if [ $INCLUDE_SPLIT -eq 0 ]; then
    ./strip_split_rendering.sh $targetdir
fi

# back up #ifdef-list
rm -f $ifdef_list
touch $ifdef_list

# Add LC3plus feature defines to options.h so that they are stripped correctly
if [ $INCLUDE_SPLIT -eq 1 ]; then
# Generate list of active defines in LC3plus defines.h
lc3plus_defines=$(
    gcc -E -dM $targetdir/lib_lc3plus/defines.h -I $targetdir/lib_com -I $targetdir/lib_debug |
@@ -114,7 +124,6 @@ if [ $INCLUDE_SPLIT -eq 1 ]; then
$lc3plus_defines_filtered
#endif /* OPTIONS_H_LC3_DEFINES */
" >>$targetdir/lib_com/options.h
fi

# get switches from options.h and append it to $ifdef_list
parse_options_opt=""
@@ -149,12 +158,10 @@ shopt -u extglob
find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \;

# run wmc_tool
"tools/$system/wmc_tool" -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c"  >> /dev/null
"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null
if [ $INCLUDE_SPLIT -eq 1 ]; then
    "tools/$system/wmc_tool" -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null
    "tools/$system/wmc_tool" -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null
fi
"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c"  >> /dev/null
"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null
"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null
"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null

# automatically enable #define WMOPS in options.h
sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*WMOPS\)[[:space:]]*\*\//\1/g" $targetdir/lib_com/options.h
+11 −0
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ class IvasBuilder(IvasBaseClass):
        defines_to_enable=[],
        defines_to_disable=[],
        instrumented=False,
        mem_only=False,
    ):
        """

@@ -272,6 +273,8 @@ class IvasBuilder(IvasBaseClass):
            instrument_cmd = [
                os.path.join(self.src_dir, "scripts", "prepare_instrumentation.sh")
            ]
            if mem_only:
                instrument_cmd.append("mem_only")
            build_log.write(" ".join(instrument_cmd))
            build_log.write("\n")
            build_result = subprocess.run(
@@ -640,6 +643,7 @@ class IvasSvnBuilder(IvasBuilder):
        defines_to_enable=[],
        defines_to_disable=[],
        instrumented=False,
        mem_only=False,
    ):
        """

@@ -668,6 +672,7 @@ class IvasSvnBuilder(IvasBuilder):
            defines_to_enable=defines_to_enable,
            defines_to_disable=defines_to_disable,
            instrumented=instrumented,
            mem_only=mem_only,
        )


@@ -775,6 +780,7 @@ class IvasBuilderAndRunner(IvasBaseClass):
        formats_fname="",
        max_workers=1,
        timeout=None,
        mem_only=False,
    ):
        """

@@ -818,6 +824,7 @@ class IvasBuilderAndRunner(IvasBaseClass):
            self.build_and_run_dict[cfg_name]["defines_to_enable"] = defines_to_enable
            self.build_and_run_dict[cfg_name]["defines_to_disable"] = defines_to_disable
            self.build_and_run_dict[cfg_name]["instrumented"] = instrumented
            self.build_and_run_dict[cfg_name]["mem_only"] = mem_only
            self.build_and_run_dict[cfg_name]["make_options"] = make_options
        else:
            self.logger.console("Adding config {}".format(cfg_name), logging.INFO)
@@ -861,6 +868,7 @@ class IvasBuilderAndRunner(IvasBaseClass):
                    "defines_to_enable": defines_to_enable,
                    "defines_to_disable": defines_to_disable,
                    "instrumented": instrumented,
                    "mem_only": mem_only,
                    "make_options": make_options,
                    "analyzer": new_analyzer,
                }
@@ -1045,6 +1053,7 @@ class IvasBuilderAndRunner(IvasBaseClass):
                defines_to_enable=cfg["defines_to_enable"],
                defines_to_disable=cfg["defines_to_disable"],
                instrumented=cfg["instrumented"],
                mem_only=cfg["mem_only"],
            )
            self.build_and_run_dict[cfg_name]["runner"].encoder = self.builder.encoder
            self.build_and_run_dict[cfg_name]["runner"].decoder = self.builder.decoder
@@ -1245,6 +1254,7 @@ class IvasBuilderAndRunner(IvasBaseClass):
        defines_to_disable=None,
        formats_fname="",
        max_workers=1,
        mem_only=False,
    ):
        """

@@ -1277,6 +1287,7 @@ class IvasBuilderAndRunner(IvasBaseClass):
            defines_to_disable=defines_to_disable_check,
            formats_fname=formats_fname,
            max_workers=max_workers,
            mem_only=mem_only,
        )

    # TODO: this is used nowhere, is this still needed?