From 426e1076661dbed1d7a43ae84b2a008670de4725 Mon Sep 17 00:00:00 2001
From: Ayaka Yorihiro <36107281+ayakayorihiro@users.noreply.github.com>
Date: Thu, 12 Dec 2024 13:34:57 -0800
Subject: [PATCH] Generate queue `.data` files according to custom command size
 (#2375)

Small edits to `gen_test_data.sh` to generate `.data` files with
argument-specified lengths of commands, and a specified output
directory. If no arguments are provided, the size and the output
directory are set to the default (20000 and `<SCRIPT_DIR>/../tests`).
It's a bit hacky, but since I only need it for profiler debugging
purposes, I hope it's ok?
---
 frontends/queues/test_data_gen/gen_test_data.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/frontends/queues/test_data_gen/gen_test_data.sh b/frontends/queues/test_data_gen/gen_test_data.sh
index 1448f826d..c39b6877a 100755
--- a/frontends/queues/test_data_gen/gen_test_data.sh
+++ b/frontends/queues/test_data_gen/gen_test_data.sh
@@ -1,9 +1,17 @@
 #!/usr/bin/bash
 
-num_cmds=20000
+if [[ $# -eq 2 ]]; then # Generate custom-length command list to the specified output directory
+    num_cmds=$1
+    tests_dir=$2
+    mkdir -p ${tests_dir}/binheap/round_robin ${tests_dir}/binheap/strict ${tests_dir}/round_robin ${tests_dir}/strict # NOTE: hacky and will break when other tests are created.
+    echo "Number of commands: ${num_cmds}; output directory: ${tests_dir}"
+else
+    num_cmds=20000
+    tests_dir="$(dirname "$0")/../tests"
+fi
+
 queue_size=16
 
-tests_dir="$(dirname "$0")/../tests"
 data_gen_dir="$(dirname "$0")"