Do not create log dir when the results_dir is null

The results_dir could be null is test_runner_handler.get_test_runner_reqs(),
and results in generating $PWD/log whenever running atest command. This
change fix the bug that it will only create log dir when results_dir is
given.

Bug: 275537997
Test: atest-dev hello_world_test --host # ensure no log dir in $PWD.
Change-Id: I4e4fbb61845bfe6173a2476e031c2858bd3b48e2
diff --git a/atest/test_runners/atest_tf_test_runner.py b/atest/test_runners/atest_tf_test_runner.py
index fcfccbe..cb10e40 100644
--- a/atest/test_runners/atest_tf_test_runner.py
+++ b/atest/test_runners/atest_tf_test_runner.py
@@ -125,8 +125,10 @@
         super().__init__(results_dir, **kwargs)
         self.module_info = mod_info
         self.log_path = os.path.join(results_dir, LOG_FOLDER_NAME)
-        if not os.path.exists(self.log_path):
-            os.makedirs(self.log_path)
+        # (b/275537997) results_dir could be '' in test_runner_handler; only
+        # mkdir when it is invoked by run_tests.
+        if results_dir:
+            Path(self.log_path).mkdir(parents=True, exist_ok=True)
         log_args = {'log_root_option_name': constants.LOG_ROOT_OPTION_NAME,
                     'log_ext_option': constants.LOG_SAVER_EXT_OPTION,
                     'log_path': self.log_path,