github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/runc/tests/integration/debug.bats (about)

     1  #!/usr/bin/env bats
     2  
     3  load helpers
     4  
     5  function setup() {
     6    teardown_hello
     7    setup_hello
     8  }
     9  
    10  function teardown() {
    11    teardown_hello
    12  }
    13  
    14  @test "global --debug" {
    15    # run hello-world
    16    runc --debug run test_hello
    17    echo "${output}"
    18    [ "$status" -eq 0 ]
    19  }
    20  
    21  @test "global --debug to --log" {
    22    # run hello-world
    23    runc --log log.out --debug run test_hello
    24    [ "$status" -eq 0 ]
    25  
    26    # check output does not include debug info
    27    [[ "${output}" != *"level=debug"* ]]
    28  
    29    # check log.out was generated
    30    [ -e log.out ]
    31  
    32    # check expected debug output was sent to log.out
    33    run cat log.out
    34    [ "$status" -eq 0 ]
    35    [[ "${output}" == *"level=debug"* ]]
    36  }
    37  
    38  @test "global --debug to --log --log-format 'text'" {
    39    # run hello-world
    40    runc --log log.out --log-format "text" --debug run test_hello
    41    [ "$status" -eq 0 ]
    42  
    43    # check output does not include debug info
    44    [[ "${output}" != *"level=debug"* ]]
    45  
    46    # check log.out was generated
    47    [ -e log.out ]
    48  
    49    # check expected debug output was sent to log.out
    50    run cat log.out
    51    [ "$status" -eq 0 ]
    52    [[ "${output}" == *"level=debug"* ]]
    53  }
    54  
    55  @test "global --debug to --log --log-format 'json'" {
    56    # run hello-world
    57    runc --log log.out --log-format "json" --debug run test_hello
    58    [ "$status" -eq 0 ]
    59  
    60    # check output does not include debug info
    61    [[ "${output}" != *"level=debug"* ]]
    62  
    63    # check log.out was generated
    64    [ -e log.out ]
    65  
    66    # check expected debug output was sent to log.out
    67    run cat log.out
    68    [ "$status" -eq 0 ]
    69    [[ "${output}" == *'"level":"debug"'* ]]
    70  }