• Aleksey Khoroshilov's avatar
    Make depot_tools scripts return exit codes properly on all platforms. · 7c4f7ec4
    Aleksey Khoroshilov authored
    Changes:
    1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation.
    2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation.
    3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure.
    
    A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations.
    
    Test case for update_depot_tools changes:
    1. Make a change to depot_tools sources that will conflict with next depot_tools update
    2. Run update_depot_tools either directly or via gclient
    3. Expect a git error is triggered
    4. Inspect %errorlevel% or $? depending on platform
    5. Expected 1, but the actual result is 0.
    
    Test case for changes in other .bat files:
    1. Make a change to depot_tools sources that will conflict with next depot_tools update
    2. Run cmd /c gclient
    3. Expect a git error is triggered
    4. Inspect %errorlevel%
    5. Expected 1, but the actual result is 0.
    
    Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
    Commit-Queue: Josip Sokcevic <sokcevic@google.com>
    Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
    Reviewed-by: 's avatarBruce Dawson <brucedawson@chromium.org>
    7c4f7ec4
update_depot_tools 4.12 KB