-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_test_time_calculator.bat
68 lines (58 loc) · 1.56 KB
/
start_test_time_calculator.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@ECHO OFF
TITLE Test Time Calculator
REM -------------------------------------------------------------------
REM @description: This script calculates the total test time from all
REM CSV files in a given folder.
REM
REM @author: Starke Wang
REM
REM @param python_script: The path to the Python script.
REM -------------------------------------------------------------------
REM Clear the screen.
CLS
REM Set the path to the Python script.
SET "python_script=%~dp0test_time_calculator.py"
REM Check if the Python script exists.
IF NOT EXIST "%python_script%" (
ECHO Error: Python script not found.
PAUSE
EXIT /B 1
)
REM Run the Python script.
ECHO Running Python script...
python "%python_script%"
REM Check if the Python script executed successfully.
IF %ERRORLEVEL% NEQ 0 (
ECHO Error: Python script failed with error code %ERRORLEVEL%.
PAUSE
EXIT /B 1
)
REM Check if the result file exists and is not empty.
IF NOT EXIST "total_test_time.txt" (
ECHO Error: Result file not found.
PAUSE
EXIT /B 1
) ELSE (
FOR %%A IN ("total_test_time.txt") DO IF %%~zA EQU 0 (
ECHO Error: Result file is empty.
PAUSE
EXIT /B 1
)
)
IF NOT EXIST "test_times.csv" (
ECHO Error: Result spreadsheet not found.
PAUSE
EXIT /B 1
) ELSE (
FOR %%A IN ("test_times.csv") DO IF %%~zA EQU 0 (
ECHO Error: Result spreadsheet is empty.
PAUSE
EXIT /B 1
)
)
REM Display the result.
ECHO.
TYPE total_test_time.txt
ECHO.
REM Wait for 5 seconds and then close the window.
TIMEOUT /T 5