dataflow-analysis/run_batch_analyze.sh

31 lines
729 B
Bash
Executable file

#!/usr/bin/env bash
# Usage: ./run_batch_analyze.sh /path/to/trace_root
set -euo pipefail
if [[ $# -ne 1 ]]; then
echo "Usage: $0 /path/to/trace_root"
exit 1
fi
TRACE_ROOT="$1"
if [[ ! -d "$TRACE_ROOT" ]]; then
echo "Error: '$TRACE_ROOT' is not a directory."
exit 1
fi
for dir in "$TRACE_ROOT"/*; do
if [[ -d "$dir" ]]; then
dirname=$(basename "$dir")
# Extract everything before first underscore as type
type=$(echo "$dirname" | grep -oP '^[a-z]+(?=_)')
if [[ -z "$type" ]]; then
echo "Warning: Could not extract type from '$dirname', skipping."
continue
fi
echo "Running batch_analyze.py on $dir with filter ${type}*"
./batch_analyze.py -d "$dir" -f "${type}*"
fi
done