Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graph_net/test/batch_init_input_tensor_constraints_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ EOF
)
CONFIG=$(echo $config_json_str | base64 -w 0)

python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/torch_samples_list.txt --handler-config=$CONFIG
python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/small10_torch_samples_list.txt --handler-config=$CONFIG
4 changes: 2 additions & 2 deletions graph_net/test/dtype_gen_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mkdir -p "$OUTPUT_DIR"

# Step 1: Initialize dtype generalization passes (samples of torchvision)
python3 -m graph_net.apply_sample_pass \
--model-path-list "graph_net/config/small100_torch_samples_list.txt" \
--model-path-list "graph_net/config/small10_torch_samples_list.txt" \
--sample-pass-file-path "$GRAPH_NET_ROOT/torch/sample_pass/dtype_generalizer.py" \
--sample-pass-class-name InitDataTypeGeneralizationPasses \
--sample-pass-config $(base64 -w 0 <<EOF
Expand All @@ -24,7 +24,7 @@ EOF

# Step 2: Apply passes to generate samples
python3 -m graph_net.apply_sample_pass \
--model-path-list "graph_net/config/small100_torch_samples_list.txt" \
--model-path-list "graph_net/config/small10_torch_samples_list.txt" \
--sample-pass-file-path "$GRAPH_NET_ROOT/torch/sample_pass/dtype_generalizer.py" \
--sample-pass-class-name ApplyDataTypeGeneralizationPasses \
--sample-pass-config $(base64 -w 0 <<EOF
Expand Down
2 changes: 1 addition & 1 deletion graph_net/test/fx_graph_module_unserialize_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DECOMPOSE_PATH=/tmp/decompose_workspace

mkdir -p "$DECOMPOSE_PATH"

model_list="$GRAPH_NET_ROOT/graph_net/config/torch_samples_list.txt"
model_list="$GRAPH_NET_ROOT/graph_net/config/small10_torch_samples_list.txt"
# model_list="$GRAPH_NET_ROOT/graph_net/test/dev_model_list/validation_error_model_list.txt"

python3 -m graph_net.model_path_handler \
Expand Down
2 changes: 1 addition & 1 deletion graph_net/test/graph_variable_rename_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GRAPH_NET_ROOT=$(python3 -c "import graph_net; import os; print(os.path.dirname(
RENAMED_PATH=/tmp/graph_variable_rename_workspace

mkdir -p "$RENAMED_PATH"
model_list="$GRAPH_NET_ROOT/graph_net/config/small100_torch_samples_list.txt"
model_list="$GRAPH_NET_ROOT/graph_net/config/small10_torch_samples_list.txt"

python3 -m graph_net.model_path_handler \
--model-path-list $model_list \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ EOF
)
CONFIG=$(echo $config_json_str | base64 -w 0)

python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/small100_torch_samples_list.txt --handler-config=$CONFIG
python3 -m graph_net.model_path_handler --model-path-list $GRAPH_NET_ROOT/config/small10_torch_samples_list.txt --handler-config=$CONFIG
2 changes: 1 addition & 1 deletion graph_net/test/single_operator_decompose_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DECOMPOSE_WORKSPACE=/tmp/workspace_single_operator_decompose

mkdir -p "$DECOMPOSE_WORKSPACE"

model_list="$GRAPH_NET_ROOT/graph_net/config/small100_torch_samples_list.txt"
model_list="$GRAPH_NET_ROOT/graph_net/config/small10_torch_samples_list.txt"

python3 -m graph_net.apply_sample_pass \
--model-path-list $model_list \
Expand Down
39 changes: 39 additions & 0 deletions tools/ci/run_unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ function prepare_torch_env() {
else
LOG "[INFO] Torch environment is already ready."
fi

LOG "[INFO] Installing grpcio and protobuf..."
python3.10 -m pip install -U grpcio "protobuf>=5.26.1" > /dev/null
[ $? -ne 0 ] && LOG "[FATAL] Install grpcio or protobuf failed!" && exit -1
LOG "[INFO] grpcio and protobuf installed successfully."
}
function run_unit_test() {
UNITTEST_PATH="$GRAPH_NET_ROOT/graph_net/torch/unittest"
Expand All @@ -39,9 +44,43 @@ function run_unit_test() {
return $RET
}

function run_shell_tests() {
TEST_DIR="$GRAPH_NET_ROOT/graph_net/test"
SKIP_LIST=("cumsum_num_kernels_test.sh" "prologue_subgraph_unittest_generator_test.sh")
LOG "[INFO] Looking for shell scripts in: $TEST_DIR"

mkdir -p .tmp_bin
PY310_PATH=$(which python3.10)
ln -sf "$PY310_PATH" .tmp_bin/python
ln -sf "$PY310_PATH" .tmp_bin/python3
export PATH="$(pwd)/.tmp_bin:$PATH"

SCRIPTS=("$TEST_DIR"/*.sh)
for script in "${SCRIPTS[@]}"; do
script_name=$(basename "$script")
if [[ " ${SKIP_LIST[*]} " =~ " $script_name " ]]; then
continue
fi

LOG "[INFO] Running script: $script_name"
chmod +x "$script"
"$script" || {
EXIT_CODE=$?
LOG "[ERROR] $script_name failed with exit code $EXIT_CODE"
return $EXIT_CODE
}
LOG "[SUCCESS] $script_name finished successfully."
done

rm -rf .tmp_bin
LOG "[INFO] All shell scripts passed successfully!"
return 0
}

function main() {
prepare_torch_env
run_unit_test
run_shell_tests
}

main
Loading