forked from niqiuqiux/newhook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush_test.bat
More file actions
66 lines (57 loc) · 1.59 KB
/
push_test.bat
File metadata and controls
66 lines (57 loc) · 1.59 KB
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
@echo off
setlocal
set NEWHOOK_DIR=%~dp0
set BUILD_DIR=%NEWHOOK_DIR%build
set REMOTE_DIR=/data/local/tmp
echo ============================================
echo newhook - build, push, and run test
echo ============================================
echo.
:: ── Step 1: CMake configure ──
echo [1/4] CMake configure ...
C:\mingw64\bin\cmake.EXE ^
-DCMAKE_BUILD_TYPE:STRING=Debug ^
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE ^
--no-warn-unused-cli ^
-S "%NEWHOOK_DIR%." ^
-B "%BUILD_DIR%" ^
-G "MinGW Makefiles"
if %ERRORLEVEL% neq 0 (
echo [ERROR] CMake configure failed!
exit /b 1
)
:: ── Step 2: Build ──
echo.
echo [2/4] Building ...
C:\mingw64\bin\cmake.EXE --build "%BUILD_DIR%" --parallel
if %ERRORLEVEL% neq 0 (
echo [ERROR] Build failed!
exit /b 1
)
echo.
echo Output files:
dir /b "%BUILD_DIR%\libnewhook.a" "%BUILD_DIR%\libnewhook.so" "%BUILD_DIR%\newhook_test*" 2>nul
echo.
:: ── Step 3: Push to device ──
echo [3/4] Pushing to device (%REMOTE_DIR%) ...
adb push "%BUILD_DIR%\newhook_test" %REMOTE_DIR%/newhook_test
if %ERRORLEVEL% neq 0 (
echo [ERROR] adb push failed! Is device connected?
exit /b 1
)
adb shell chmod 755 %REMOTE_DIR%/newhook_test
:: ── Step 4: Run on device ──
echo.
echo [4/4] Running test on device ...
echo ============================================
adb shell %REMOTE_DIR%/newhook_test
set RESULT=%ERRORLEVEL%
echo ============================================
echo.
if %RESULT% equ 0 (
echo ALL TESTS PASSED
) else (
echo SOME TESTS FAILED (exit code: %RESULT%)
)
endlocal
exit /b %RESULT%