class_docstr: Tests using the GTEST_BREAK_ON_FAILURE environment variable or
  the --gtest_break_on_failure flag to turn assertion failures into
  segmentation faults.
class_docstr_tok: ["Tests","using","the","GTEST_BREAK_ON_FAILURE","environment","variable","or","the","--","gtest_break_on_failure","flag","to","turn","assertion","failures","into","segmentation","faults","."]
docstr: Runs gtest_break_on_failure_unittest_ and verifies that it does
  (or does not) have a seg-fault.
  
  Args:
    env_var_value:    value of the GTEST_BREAK_ON_FAILURE environment
                      variable; None if the variable should be unset.
    flag_value:       value of the --gtest_break_on_failure flag;
                      None if the flag should not be present.
    expect_seg_fault: 1 if the program is expected to generate a seg-fault;
                      0 otherwise.
docstr_tok: ["Runs","gtest_break_on_failure_unittest_","and","verifies","that","it","does","(","or","does","not",")","have","a","seg-fault",".","Args",":","env_var_value",":","value","of","the","GTEST_BREAK_ON_FAILURE","environment","variable",";","None","if","the","variable","should","be","unset",".","flag_value",":","value","of","the","--","gtest_break_on_failure","flag",";","None","if","the","flag","should","not","be","present",".","expect_seg_fault",":","1","if","the","program","is","expected","to","generate","a","seg-fault",";","0","otherwise","."]
code: def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault):
      """Runs gtest_break_on_failure_unittest_ and verifies that it does
      (or does not) have a seg-fault.
  
      Args:
        env_var_value:    value of the GTEST_BREAK_ON_FAILURE environment
                          variable; None if the variable should be unset.
        flag_value:       value of the --gtest_break_on_failure flag;
                          None if the flag should not be present.
        expect_seg_fault: 1 if the program is expected to generate a seg-fault;
                          0 otherwise.
      """
  
      SetEnvVar(BREAK_ON_FAILURE_ENV_VAR, env_var_value)
  
      if env_var_value is None:
          env_var_value_msg = " is not set"
      else:
          env_var_value_msg = "=" + env_var_value
  
      if flag_value is None:
          flag = ""
      elif flag_value == "0":
          flag = "--%s=0" % BREAK_ON_FAILURE_FLAG
      else:
          flag = "--%s" % BREAK_ON_FAILURE_FLAG
  
      command = [EXE_PATH]
      if flag:
          command.append(flag)
  
      if expect_seg_fault:
          should_or_not = "should"
      else:
          should_or_not = "should not"
  
      has_seg_fault = Run(command)
  
      SetEnvVar(BREAK_ON_FAILURE_ENV_VAR, None)
  
      msg = (
          'when %s%s, an assertion failure in "%s" %s cause a seg-fault.'
          % (
              BREAK_ON_FAILURE_ENV_VAR,
              env_var_value_msg,
              " ".join(command),
              should_or_not,
          )
      )
      self.assert_(has_seg_fault == expect_seg_fault, msg)
  
file_path: xlearn/gtest/test/gtest_break_on_failure_unittest.py
imports: import gtest_test_utils
  import os
  import sys
label_desc: Use image node_id 1 for calling the GTestBreakOnFailureUnitTest obj's underlying member method code with example usage: obj.RunAndVerify(env_var_value, flag_value, expect_seg_fault) without return types