summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2024-01-10 12:02:40 +0100
committerBirte Kristina Friesel <birte.friesel@uos.de>2024-01-10 12:02:40 +0100
commit60c418c42cc02e77aa1aeecfa79f74330d201b85 (patch)
tree8789afac824fc521edefe123f241d95c4918eed5
parentd5ebb9c878fd8153c6e95793bc08224c7923ff98 (diff)
CLI: Add a minimal sanity check
-rwxr-xr-xbin/analyze-archive.py1
-rwxr-xr-xbin/analyze-kconfig.py1
-rwxr-xr-xbin/analyze-log.py1
-rw-r--r--lib/cli.py10
4 files changed, 13 insertions, 0 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index c91150d..1a83bfe 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -274,6 +274,7 @@ if __name__ == "__main__":
parser.add_argument("measurement", nargs="+")
args = parser.parse_args()
+ dfatool.cli.sanity_check(args)
if args.log_level:
numeric_level = getattr(logging, args.log_level.upper(), None)
diff --git a/bin/analyze-kconfig.py b/bin/analyze-kconfig.py
index 098d6ba..68e4668 100755
--- a/bin/analyze-kconfig.py
+++ b/bin/analyze-kconfig.py
@@ -168,6 +168,7 @@ def main():
)
args = parser.parse_args()
+ dfatool.cli.sanity_check(args)
if args.skip_param_stats and not args.force_tree:
print("--skip-param-stats requires --force-tree", file=sys.stderr)
diff --git a/bin/analyze-log.py b/bin/analyze-log.py
index 9c24641..2ac1e84 100755
--- a/bin/analyze-log.py
+++ b/bin/analyze-log.py
@@ -68,6 +68,7 @@ def main():
help="Path to benchmark output (.txt or .txt.xz)",
)
args = parser.parse_args()
+ dfatool.cli.sanity_check(args)
if args.log_level:
numeric_level = getattr(logging, args.log_level.upper(), None)
diff --git a/lib/cli.py b/lib/cli.py
index 0ebe42d..5c6544c 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -4,10 +4,20 @@ import dfatool.functions as df
import dfatool.plotter
import logging
import numpy as np
+import os
+import sys
logger = logging.getLogger(__name__)
+def sanity_check(args):
+ if args.force_tree and bool(int(os.getenv("DFATOOL_FIT_FOL", "0"))):
+ print(
+ "--force-tree and DFATOOL_FIT_FOL=1 are mutually exclusive", file=sys.stderr
+ )
+ sys.exit(1)
+
+
def print_static(model, static_model, name, attribute, with_dependence=False):
unit = " "
if attribute == "power":