Skip to content

Commit

Permalink
DAOS-4582 tests: clean up cart.log printing
Browse files Browse the repository at this point in the history
Clean up (hopefully unneccessary) cart.log printers. Put cart.log's into
default DAOS logs dir from the very beginning.

Competing approaches:
  1. Find where cart.log's are currently, and move them to artifacts
     dir.
  2. Put cart.log's into artifacts dir from the start.

Up to now, this branch has used approach #1. #2 appears to be the far
simpler approach; so KISS, reduce complexity -- try #2.

Skip-build-leap15-rpm: true
Skip-build-ubuntu-clang: true
Skip-build-leap15-icc: true
Skip-coverity-test: true
Skip-checkpatch: true
Quick-build: true
Skip-run_test: true
Test-tag: all_cart
Skip-func-test-leap15: true
Skip-func-hw-test-small: true
Skip-func-hw-test-medium: true
Skip-func-hw-test-large: true

Signed-off-by: Ethan Mallove <[email protected]>
  • Loading branch information
mallove79 committed Aug 16, 2020
1 parent 5328c79 commit e500d3d
Show file tree
Hide file tree
Showing 15 changed files with 0 additions and 119 deletions.
2 changes: 0 additions & 2 deletions src/tests/ftest/cart/corpc/cart_corpc_five_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)

def test_cart_corpc(self):
"""
Expand All @@ -61,7 +60,6 @@ def test_cart_corpc(self):

self.utils.launch_test(self, cmd)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
2 changes: 0 additions & 2 deletions src/tests/ftest/cart/corpc/cart_corpc_one_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test teardown """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)

def test_cart_corpc(self):
"""
Expand All @@ -61,7 +60,6 @@ def test_cart_corpc(self):

self.utils.launch_test(self, cmd)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/corpc/cart_corpc_two_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_corpc(self):
"""
Expand All @@ -62,7 +60,6 @@ def test_cart_corpc(self):

self.utils.launch_test(self, cmd)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/ctl/cart_ctl_five_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_ctl(self):
"""
Expand Down Expand Up @@ -82,7 +80,6 @@ def test_cart_ctl(self):

self.utils.stop_process(srv_rtn, self.utils)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/ctl/cart_ctl_one_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_ctl(self):
"""
Expand Down Expand Up @@ -85,7 +83,6 @@ def test_cart_ctl(self):
clicmd = self.utils.build_cmd(self, self.env, "cli6")
self.utils.launch_test(self, clicmd, srv_rtn)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test teardown """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_ghost_rank_rpc(self):
"""
Expand All @@ -62,7 +60,6 @@ def test_cart_ghost_rank_rpc(self):

self.utils.launch_test(self, cmd)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/group_test/group_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.log_copy(self)
self.utils.dump_cart_logs_static(self.utils)

def test_group(self):
"""
Expand All @@ -70,7 +68,6 @@ def test_group(self):
cmd = srv_cmd
self.utils.launch_test(self, cmd)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/iv/cart_iv_one_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.log_copy(self)
self.utils.dump_cart_logs_static(self.utils)

def _verify_action(self, action):
"""verify the action"""
Expand Down Expand Up @@ -304,7 +302,6 @@ def test_cart_iv(self):
if failed:
self.fail("Test failed.\n")

self.utils.log_copy(self)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/iv/cart_iv_two_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def _verify_action(self, action):
"""verify the action"""
Expand Down Expand Up @@ -304,7 +302,6 @@ def test_cart_iv(self):
if failed:
self.fail("Test failed.\n")

self.utils.log_copy(self)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/no_pmix/cart_nopmix_multictx_one_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_no_pmix(self):
"""
Expand All @@ -84,7 +82,6 @@ def test_cart_no_pmix(self):

self.utils.print("Finished waiting for {}".format(p))

self.utils.log_copy(self)

if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_no_pmix_launcher(self):
"""
Expand Down
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/rpc/cart_rpc_one_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_rpc(self):
"""
Expand All @@ -61,7 +59,6 @@ def test_cart_rpc(self):
clicmd = self.utils.build_cmd(self, self.env, "test_clients")

self.utils.launch_srv_cli_test(self, srvcmd, clicmd)
self.utils.log_copy(self)
self.utils.log_check(self)

if __name__ == "__main__":
Expand Down
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/rpc/cart_rpc_two_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_rpc(self):
"""
Expand All @@ -61,7 +59,6 @@ def test_cart_rpc(self):
clicmd = self.utils.build_cmd(self, self.env, "test_clients")

self.utils.launch_srv_cli_test(self, srvcmd, clicmd)
self.utils.log_copy(self)
self.utils.log_check(self)

if __name__ == "__main__":
Expand Down
3 changes: 0 additions & 3 deletions src/tests/ftest/cart/selftest/cart_selftest_three_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def setUp(self):
def tearDown(self):
""" Test tear down """
print("Run TearDown\n")
self.utils.dump_cart_logs_static(self.utils)
self.utils.log_copy(self)

def test_cart_selftest(self):
"""
Expand Down Expand Up @@ -79,7 +77,6 @@ def test_cart_selftest(self):
clicmd = self.utils.build_cmd(self, self.env, "cli3")
self.utils.launch_test(self, clicmd, srv_rtn)

self.utils.log_copy(self)

if __name__ == "__main__":
main()
80 changes: 0 additions & 80 deletions src/tests/ftest/cart/util/cart_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ def stop_process(proc, self):
except Exception:
proc.kill()

# Putting this in the tearDown section of the test .py file, might
# not be enough. Copy logs over when test procs are reaped.
self.dump_cart_logs()

return procrtn

def get_env(self, cartobj):
Expand Down Expand Up @@ -423,28 +419,6 @@ def print(self, cmd):
self.stdout.info(cmd)
self.progress_log.info(cmd)

@staticmethod
def log_copy(cartobj):
print("Entering log_copy")
"""Copy cart log files to Jenkins-accessible directory """

import shutil
import tempfile

print("Copy log path", cartobj.log_path, " to ", os.environ["AVOCADO_TEST_LOGDIR"])
# Copy log files to jenkins dir

# Source path
src = cartobj.log_path

# Destination path
_dest = os.environ["AVOCADO_TEST_LOGDIR"]
dest = tempfile.mkdtemp(dir = _dest)

# Copy the content of source to destination
rc = shutil.copytree(src, dest + "-testLogs")
print("shutil.copytree: ", src, " to ", dest, ", rc = ", rc)

@staticmethod
def log_check(cartobj):
print("Entering log_check")
Expand All @@ -470,57 +444,3 @@ def log_check(cartobj):
cl = cart_logparse.LogIter(log_file)
c_log_test = cart_logtest.LogTest(cl)
c_log_test.check_log_file(strict_test)

def dump_cart_logs(self):
print("Entering dump_cart_logs")
"""Print contents of cart.log
Returns:
void
"""

if self.cart_logs_dumped_already:
print ("We already dumped the cart.log. No need to repeat.")
return

pattern = 'cart.log*'

# DEBUGGING
import os
print("\ndump_cart_logs:483: ENV : %s\n" % os.environ)
print("\ndump_cart_logs:483: os.getcwd() : %s\n" % os.getcwd())

# Find the cart.log in one of these directories (which might differ between
# different testing environments)
directories = [
'.',
os.environ["AVOCADO_TEST_LOGDIR"],
os.environ["AVOCADO_TEST_OUTPUTDIR"],
os.environ["AVOCADO_TEST_WORKDIR"],
os.environ["AVOCADO_TESTS_COMMON_TMPDIR"]
]

for directory in directories:
print("Line 492: for directory ", directory)
for root, dirs, files in os.walk(directory):
print("Line 492: for root: ", root)
for basename in files:
print("Line 492: for basename: ", basename)
if fnmatch.fnmatch(basename, pattern):
filename = os.path.join(root, basename)
print('Found cart.log file: ', filename)
log = open(filename, "r").read()
print(log)
self.cart_logs_dumped_already = True

# Assume there's only one cart.log per test process
return

@staticmethod
def dump_cart_logs_static(self):
"""Static wrapper for dump_cart_logs
Returns:
void
"""
self.dump_cart_logs()

0 comments on commit e500d3d

Please sign in to comment.