global_exe_path.h 934 B

1234567891011121314151617181920212223242526
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_TESTING_BASE_GLOBAL_EXE_PATH_H_
  5. #define CARBON_TESTING_BASE_GLOBAL_EXE_PATH_H_
  6. #include "llvm/ADT/StringRef.h"
  7. // When using the Carbon `main` function for GoogleTest, we export some extra
  8. // information about the test binary that can be accessed with this header.
  9. namespace Carbon::Testing {
  10. // The executable path of the test binary.
  11. auto GetExePath() -> llvm::StringRef;
  12. // Sets the executable path of a test binary from its `argv[0]`.
  13. //
  14. // This function must only be called once for an execution, and before any
  15. // callers to `GetExePath`. Typically, it is called from within `main`.
  16. auto SetExePath(const char* argv_zero) -> void;
  17. } // namespace Carbon::Testing
  18. #endif // CARBON_TESTING_BASE_GLOBAL_EXE_PATH_H_