Skip to content

Commit b09b2f3

Browse files
committed
Add depends install and test scripts
1 parent 7f7d5fe commit b09b2f3

4 files changed

Lines changed: 657 additions & 0 deletions

File tree

scripts/README.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Testing Scripts
2+
3+
Unified test execution scripts for InfiniMetrics.
4+
5+
## 🚀 Quick Start
6+
7+
```bash
8+
# Run tests with input file(s)
9+
./scripts/run_tests.sh test.json
10+
11+
# Run tests in a directory
12+
./scripts/run_tests.sh test_dir/
13+
14+
# Run multiple input files
15+
./scripts/run_tests.sh test1.json test2.json test3.json
16+
```
17+
18+
## 📁 Structure
19+
20+
```
21+
scripts/
22+
├── run_tests.sh # Unified test execution script
23+
└── common/ # Shared utilities
24+
├── install_deps.sh # Dependency management (check + install)
25+
└── prepare_env.sh # Environment preparation functions
26+
```
27+
28+
## 📝 Script Organization
29+
30+
### Main Script: `run_tests.sh`
31+
32+
Unified test execution script with automatic dependency management.
33+
34+
**Usage (Direct Execution):**
35+
```bash
36+
./scripts/run_tests.sh [OPTIONS] <input_paths...>
37+
```
38+
39+
**Usage (Source Mode - Environment Variables Persist):**
40+
```bash
41+
source scripts/run_tests.sh
42+
run_tests [OPTIONS] <input_paths...>
43+
```
44+
45+
**Options:**
46+
```bash
47+
--check <types> Check specific dependencies before running (comma-separated)
48+
Types: hardware, operator, all
49+
--no-check Skip dependency checking
50+
--help, -h Show help message
51+
```
52+
53+
**Input paths:**
54+
- Can be JSON files or directories
55+
56+
**Examples:**
57+
```bash
58+
# Direct execution (recommended for CI/automation)
59+
./scripts/run_tests.sh test.json
60+
./scripts/run_tests.sh test_dir/
61+
./scripts/run_tests.sh test1.json test2.json
62+
./scripts/run_tests.sh --check hardware test.json
63+
64+
# Source mode (recommended for development)
65+
source scripts/run_tests.sh
66+
run_tests test.json
67+
run_tests --check all test.json
68+
```
69+
70+
### Common Functions (`common/`)
71+
72+
**`install_deps.sh`**: Unified dependency management (check + install)
73+
74+
Can be used standalone or sourced by other scripts.
75+
76+
**Standalone usage:**
77+
```bash
78+
# Install specific component
79+
export INFINICORE_PATH="/path/to/InfiniCore"
80+
source scripts/common/install_deps.sh operator # Install InfiniCore
81+
source scripts/common/install_deps.sh hardware # Build CUDA benchmark
82+
source scripts/common/install_deps.sh all # Install everything
83+
```
84+
85+
**Components:**
86+
- `operator` - InfiniCore (operator testing)
87+
- `hardware` - CUDA memory benchmark (hardware testing)
88+
89+
**Checking functions** (available when sourced):
90+
- `check_cuda` - Check NVIDIA CUDA toolkit
91+
- `check_infinicore` - Check InfiniCore package
92+
93+
**Installation functions** (available when sourced):
94+
- `install_infinicore` - Install InfiniCore from source
95+
- `install_hardware` - Build CUDA memory benchmark
96+
97+
**`prepare_env.sh`**: Environment preparation functions
98+
- `log_test_start` - Log test start message with timestamp
99+
- `log_test_end` - Log test completion with exit code
100+
- `cleanup_on_error` - Error trap handler
101+
- `get_timestamp` - Get current timestamp
102+
103+
## 📊 Output
104+
105+
All test results are saved to:
106+
```
107+
output/
108+
```
109+
110+
## ⚠️ Requirements
111+
112+
- Python 3.10+
113+
- Bash 4.0+
114+
- CUDA toolkit (for CUDA hardware tests)
115+
- InfiniCore source (for operator tests)

0 commit comments

Comments
 (0)