From 3b035f650efd2b73f90b281b90739b08b1e780d0 Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Thu, 28 Jan 2021 16:35:21 +0100 Subject: [PATCH] minitest: add utility script to get unknown bits Signed-off-by: Alessandro Comodi --- minitests/get_unknown_bits_count.sh | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 minitests/get_unknown_bits_count.sh diff --git a/minitests/get_unknown_bits_count.sh b/minitests/get_unknown_bits_count.sh new file mode 100755 index 00000000..c57764c3 --- /dev/null +++ b/minitests/get_unknown_bits_count.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# Copyright (C) 2017-2020 The Project X-Ray Authors. +# +# Use of this source code is governed by a ISC-style +# license that can be found in the LICENSE file or at +# https://opensource.org/licenses/ISC +# +# SPDX-License-Identifier: ISC + +function display_help() { + echo "This is a utility script that helps displaying the total" + echo "amount of unknown bits in the various minitest." + echo "" + echo "The minitest must contain a Makefile which flow ends in the" + echo "generation of a FASM file." + echo "" + echo "Arguments:" + echo " -m|--minitests: list of minitest directories from which the FASM files are" + echo " generated and parsed to get the total amount of missing" +} + +MINITEST_DIRS=() + +MINITEST=0 + +for arg in $@; do + case "$arg" in + -m|--minitests) + MINITEST=1 + ;; + *) + if [ $MINITEST -eq 1 ]; then + MINITEST_DIRS+=($arg) + else + display_help + exit 1 + fi + ;; + esac +done + +if [ $# -eq 0 ]; then + display_help + exit 1 +fi + +for MINITEST in ${MINITEST_DIRS[*]} +do + echo "-----------------------------" + echo "$MINITEST" + echo "-----------------------------" + make -q -C $MINITEST all + FASM_FILE=`find $MINITEST -name "*.fasm"` + MISSING_BITS=`grep "unknown_bit" $FASM_FILE | wc -l` + MISSING_FRAMES=`grep "In frame" $FASM_FILE | wc -l` + + echo "Total of unknown bits: $MISSING_BITS" + echo "Total of unknown frames: $MISSING_FRAMES" + echo "" +done