Beispiel #1
0
 def setUp(self):
     utils_lib.init_case(self)
     if utils_lib.is_arch(self, arch='aarch64'):
         ltp_url = self.params.get('ltp_url_aarch64')
     else:
         ltp_url = self.params.get('ltp_url_x86_64')
     utils_lib.pkg_install(self, pkg_name='ltp', pkg_url=ltp_url)
     self.cursor = utils_lib.get_cmd_cursor(self, cmd='journalctl --since today', rmt_redirect_stdout=True)
Beispiel #2
0
 def setUp(self):
     utils_lib.init_case(self)
     if utils_lib.is_arch(self, arch='aarch64'):
         blktests_url = self.params.get('blktests_url_aarch64')
     else:
         blktests_url = self.params.get('blktests_url_x86_64')
     utils_lib.pkg_install(self, pkg_name='blktests', pkg_url=blktests_url)
     self.cursor = utils_lib.get_cmd_cursor(self,
                                            cmd='journalctl --since today')
Beispiel #3
0
 def setUp(self):
     if not self.vm:
         self.skipTest("Skip as no VM inited")
     if not self.vm.provider == 'nutanix':
         self.skipTest("Skip as not Nutanix AHV platform")
     if self.vm.is_stopped():
         self.vm.start(wait=True)
     utils_lib.init_case(self)
     self.dmesg_cursor = utils_lib.get_cmd_cursor(self, cmd='dmesg -T')
Beispiel #4
0
 def setUp(self):
     utils_lib.init_case(self)
     self.dmesg_cursor = utils_lib.get_cmd_cursor(self, cmd='dmesg -T')
     cmd = "sudo ip link show|grep mtu|grep -v lo|awk -F':' '{print $2}'"
     output = utils_lib.run_cmd(self, cmd, expect_ret=0)
     self.nic = "eth0"
     self.log.info(
         "Test which nic connecting to public, if no found, use {} by default"
         .format(self.nic))
     for net in output.split('\n'):
         cmd = "ping {} -c 2 -I {}".format(self.params.get('ping_server'),
                                           net)
         ret = utils_lib.run_cmd(self, cmd, ret_status=True)
         if ret == 0:
             self.nic = net
             break
Beispiel #5
0
 def setUp(self):
     utils_lib.init_case(self)
     if utils_lib.is_arch(self, arch='aarch64'):
         ltp_rpm = self.utils_dir + '/ltp-master.aarch64.rpm'
         ltp_rpm_tmp = '/tmp/ltp-master.aarch64.rpm'
     else:
         ltp_rpm = self.utils_dir + '/ltp-master.x86_64.rpm'
         ltp_rpm_tmp = '/tmp/ltp-master.x86_64.rpm'
     cmd = 'ls -l /opt/ltp/runtest/smoketest'
     ret = utils_lib.run_cmd(self, cmd, ret_status=True, msg='Check if it is ltp version with smoketest')
     if not utils_lib.is_pkg_installed(self, pkg_name='ltp',is_install=False) or ret != 0:
         if self.params['remote_node'] is not None:
             self.log.info('Copy {} to remote'.format(ltp_rpm))
             self.SSH.put_file(local_file=ltp_rpm, rmt_file=ltp_rpm_tmp)
             ltp_rpm = ltp_rpm_tmp
     if ret != 0:
         force = True
     else:
         force = False
     utils_lib.pkg_install(self, pkg_name='ltp', pkg_url=ltp_rpm, force=force)
     self.cursor = utils_lib.get_cmd_cursor(self, rmt_redirect_stdout=True)
 def setUp(self):
     utils_lib.init_case(self)
     self.dmesg_cursor = utils_lib.get_cmd_cursor(self, cmd='dmesg -T')
 def test_systemd_coredump(self):
     """
     case_name:
         test_systemd_coredump
     case_file:
         os_tests.tests.test_general_test.TestGeneralTest.test_systemd_coredump
     component:
         systemd
     bugzilla_id:
         2025479, 1905582
     is_customer_case:
         False
     testplan:
         N/A
     maintainer:
         [email protected]
     description:
         The DefaultLimitCORESoft is set to 0 by default.
         Test systemd-coredump can save process core successfully when process crashed
     key_steps:
         1. # systemctl show | grep CORE
            DefaultLimitCORE=infinity
            DefaultLimitCORESoft=0 (rhel default set)
         2. create test.c
            #include <stdio.h>
            #include <stdlib.h>
            void main(){
            int x;
            free(&x);
            }
         3. # gcc -g -o pp test.c
         4. # ./pp
     expect_result:
         pp crashed and new core file is generated under /var/lib/systemd/coredump
     debug_want:
         - journal log
     """
     test_str = '''
     #include <stdio.h>
     #include <stdlib.h>
     void main(){
         int x;
         free(&x);
     }
     '''
     product_name = utils_lib.get_os_release_info(self, field='NAME')
     if 'Red Hat Enterprise Linux' in product_name:
         cmd = 'systemctl show | grep CORE'
         utils_lib.run_cmd(
             self,
             cmd,
             expect_kw='DefaultLimitCORESoft=0,DefaultLimitCORE=infinity',
             msg='check default limit core setting')
     utils_lib.run_cmd(self,
                       'ulimit -c 0;ulimit -c',
                       expect_ret=0,
                       expect_kw='0',
                       msg='test user can change limit core setting')
     utils_lib.run_cmd(self,
                       'ulimit -c unlimited;ulimit -c',
                       expect_ret=0,
                       expect_kw='unlimited',
                       msg='test user can change limit core setting')
     utils_lib.run_cmd(self,
                       'sudo rm -rf /var/lib/systemd/coredump/core.pp*',
                       msg='clean up core files before testing')
     self.cursor = utils_lib.get_cmd_cursor(self,
                                            cmd='journalctl -b0',
                                            rmt_redirect_stdout=True)
     test_file = '/tmp/test.c'
     utils_lib.is_cmd_exist(self, 'gcc')
     cmd = "echo '{}' > {}".format(test_str, test_file)
     utils_lib.run_cmd(self,
                       cmd,
                       expect_ret=0,
                       msg='generate {}'.format(test_file))
     cmd = "gcc -g -o /tmp/pp {}".format(test_file)
     utils_lib.run_cmd(self, cmd, expect_ret=0)
     utils_lib.run_cmd(self,
                       'ulimit -c unlimited;/tmp/pp',
                       msg='run it to trigger core dump')
     utils_lib.run_cmd(self,
                       'sudo ls /var/lib/systemd/coredump/core.pp*',
                       expect_ret=0,
                       msg='check core file generated')
     utils_lib.check_log(self,
                         "error,warn,fail",
                         log_cmd='journalctl -b0',
                         cursor=self.cursor,
                         rmt_redirect_stdout=True)