Add skip_tmpdir_check arg in crash script (#11539)

Summary:
Add `skip_tmpdir_check` argument in crash script. If `tmp_dir` is on remote storage and exist, `isdir` will be false (checking on local storage) leading to exit. By passing `skip_tmpdir_check` with `crashtest.py`, the dir check can be skipped.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11539

Test Plan: Ran locally

Reviewed By: anand1976

Differential Revision: D46740456

Pulled By: akankshamahajan15

fbshipit-source-id: 8726882ef53d2c84b604c7515e84eda6d1bf797c
oxigraph-main
Akanksha Mahajan 1 year ago committed by Facebook GitHub Bot
parent f7aa70a72f
commit 5187ac2af3
  1. 6
      tools/db_crashtest.py

@ -734,6 +734,7 @@ def gen_cmd(params, unknown_params):
"stress_cmd", "stress_cmd",
"test_tiered_storage", "test_tiered_storage",
"cleanup_cmd", "cleanup_cmd",
"skip_tmpdir_check"
} }
and v is not None and v is not None
] ]
@ -1016,6 +1017,7 @@ def main():
parser.add_argument("--stress_cmd") parser.add_argument("--stress_cmd")
parser.add_argument("--test_tiered_storage", action="store_true") parser.add_argument("--test_tiered_storage", action="store_true")
parser.add_argument("--cleanup_cmd") parser.add_argument("--cleanup_cmd")
parser.add_argument("--skip_tmpdir_check", action="store_true")
all_params = dict( all_params = dict(
list(default_params.items()) list(default_params.items())
@ -1042,13 +1044,13 @@ def main():
args, unknown_args = parser.parse_known_args() args, unknown_args = parser.parse_known_args()
test_tmpdir = os.environ.get(_TEST_DIR_ENV_VAR) test_tmpdir = os.environ.get(_TEST_DIR_ENV_VAR)
if test_tmpdir is not None: if test_tmpdir is not None and not args.skip_tmpdir_check:
isdir = False isdir = False
try: try:
isdir = os.path.isdir(test_tmpdir) isdir = os.path.isdir(test_tmpdir)
if not isdir: if not isdir:
print( print(
"%s env var is set to a non-existent directory: %s" "ERROR: %s env var is set to a non-existent directory: %s. Update it to correct directory path."
% (_TEST_DIR_ENV_VAR, test_tmpdir) % (_TEST_DIR_ENV_VAR, test_tmpdir)
) )
sys.exit(1) sys.exit(1)

Loading…
Cancel
Save