<commit_before>#[PROTEXCAT]
#\License: ALL RIGHTS RESERVED

"""System boot time"""
import os
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import collect_pnp_log, get_files_dir


class BootTimeTest(oeRuntimeTest):

    def _setup(self):
        (status, output) = self.target.copy_to(
            os.path.join(get_files_dir(),
                         'systemd-analyze'), "/tmp/systemd-analyze")
        self.assertEqual(
            status,
            0,
            msg="systemd-analyze could not be copied. Output: %s" %
            output)
        (status, output) = self.target.run(" ls -la /tmp/systemd-analyze")
        self.assertEqual(
            status,
            0,
            msg="Failed to find systemd-analyze command")

    def test_boot_time(self):
        self._setup()
        filename = os.path.basename(__file__)
        casename = os.path.splitext(filename)[0]
        (status, output) = self.target.run("/tmp/systemd-analyze time"
                                           " | awk -F '=' '{print $2}'")
        collect_pnp_log(casename, output)
        print "\n%s:%s\n" % (casename, output)
        self.assertEqual(status, 0, output)<commit_msg>Used new collect_pnp_log to save boottime and logs<commit_after>#[PROTEXCAT]
#\License: ALL RIGHTS RESERVED

"""System boot time"""
import os
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import collect_pnp_log, get_files_dir


class BootTimeTest(oeRuntimeTest):

    def _setup(self):
        (status, output) = self.target.copy_to(
            os.path.join(get_files_dir(),
                         'systemd-analyze'), "/tmp/systemd-analyze")
        self.assertEqual(
            status,
            0,
            msg="systemd-analyze could not be copied. Output: %s" %
            output)
        (status, output) = self.target.run(" ls -la /tmp/systemd-analyze")
        self.assertEqual(
            status,
            0,
            msg="Failed to find systemd-analyze command")

    def test_boot_time(self):
        self._setup()
        filename = os.path.basename(__file__)
        casename = os.path.splitext(filename)[0]
        (status, output) = self.target.run("/tmp/systemd-analyze time"
                                           " | awk -F '=' '{print $2}'")
        collect_pnp_log(casename, casename, output)
        print "\n%s:%s\n" % (casename, output)
        (status, output) = self.target.run("/tmp/systemd-analyze time")
        logname = casename + "-systemd-analyze"
        collect_pnp_log(casename, logname, output)
        self.assertEqual(status, 0, output)
{'fraction_non_alphanumeric': 0.12240184757505773, 'fraction_numerical': 0.003849114703618168, 'mean_word_length': 2.1275571600481347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4210350', 'n_tokens_mistral': 806, 'n_tokens_neox': 788, 'n_words': 173}