All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] runtime/systemd: Fix for boot time string parse error
@ 2016-02-01 15:53 Benjamin Esquivel
  2016-02-01 18:48 ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Esquivel @ 2016-02-01 15:53 UTC (permalink / raw)
  To: openembedded-core

boot time string can change its format of the output of the amount of time
it took to boot. It is required to handle graceful fail of the parsing
errors that it provokes

[YOCTO #8889]

Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
---
 meta/lib/oeqa/runtime/systemd.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py
index 03c56ef..2b2f10d 100644
--- a/meta/lib/oeqa/runtime/systemd.py
+++ b/meta/lib/oeqa/runtime/systemd.py
@@ -145,8 +145,7 @@ class SystemdJournalTests(SystemdTest):
         except AssertionError:
             self.fail("Error occurred while calling journalctl")
         if not len(output):
-            self.fail("Error: unable to obtain the startup time from\
-                    systemd journal")
+            self.fail("Error, unable to get startup time from systemd journal")
 
         # check for the regular expression items that match the startup time
         for line in output.split('\n'):
@@ -156,20 +155,23 @@ class SystemdJournalTests(SystemdTest):
         if check_match:
             print "%s" % check_match
         else:
-            self.fail("Error while obtaining the boot time from journalctl")
+            self.skipTest("Error at obtaining the boot time from journalctl")
         boot_time_sec = 0
 
         # get the numeric values from the string and convert them to seconds
         # same data will be placed in list and string for manipulation
         l_boot_time = check_match.split(" ")[-2:]
         s_boot_time = " ".join(l_boot_time)
-        # Obtain the minutes it took to boot
-        if l_boot_time[0].endswith('min') and l_boot_time[0][0].isdigit():
-            boot_time_min = s_boot_time.split("min")[0]
-            # convert to seconds and accumulate it
-            boot_time_sec += int(boot_time_min) * 60
-        # Obtain the seconds it took to boot and accumulate
-        boot_time_sec += float(l_boot_time[1].split("s")[0])
+        try:
+            # Obtain the minutes it took to boot
+            if l_boot_time[0].endswith('min') and l_boot_time[0][0].isdigit():
+                boot_time_min = s_boot_time.split("min")[0]
+                # convert to seconds and accumulate it
+                boot_time_sec += int(boot_time_min) * 60
+            # Obtain the seconds it took to boot and accumulate
+            boot_time_sec += float(l_boot_time[1].split("s")[0])
+        except ValueError:
+            self.skipTest("Error when parsing time from boot string")
         #Assert the target boot time against systemd's unit start timeout
         if boot_time_sec > systemd_TimeoutStartSec:
             print "Target boot time %s exceeds systemd's TimeoutStartSec %s"\
-- 
2.5.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] runtime/systemd: Fix for boot time string parse error
  2016-02-01 15:53 [PATCH] runtime/systemd: Fix for boot time string parse error Benjamin Esquivel
@ 2016-02-01 18:48 ` Khem Raj
  2016-02-15 17:32   ` Benjamin Esquivel
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2016-02-01 18:48 UTC (permalink / raw)
  To: Benjamin Esquivel; +Cc: Patches and discussions about the oe-core layer

On Mon, Feb 1, 2016 at 7:53 AM, Benjamin Esquivel
<benjamin.esquivel@linux.intel.com> wrote:
> boot time string can change its format of the output of the amount of time
> it took to boot. It is required to handle graceful fail of the parsing
> errors that it provokes
>
> [YOCTO #8889]
>
> Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
> ---
>  meta/lib/oeqa/runtime/systemd.py | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py
> index 03c56ef..2b2f10d 100644
> --- a/meta/lib/oeqa/runtime/systemd.py
> +++ b/meta/lib/oeqa/runtime/systemd.py
> @@ -145,8 +145,7 @@ class SystemdJournalTests(SystemdTest):
>          except AssertionError:
>              self.fail("Error occurred while calling journalctl")
>          if not len(output):
> -            self.fail("Error: unable to obtain the startup time from\
> -                    systemd journal")
> +            self.fail("Error, unable to get startup time from systemd journal")
>
>          # check for the regular expression items that match the startup time
>          for line in output.split('\n'):
> @@ -156,20 +155,23 @@ class SystemdJournalTests(SystemdTest):
>          if check_match:
>              print "%s" % check_match
>          else:
> -            self.fail("Error while obtaining the boot time from journalctl")
> +            self.skipTest("Error at obtaining the boot time from journalctl")
>          boot_time_sec = 0
>
>          # get the numeric values from the string and convert them to seconds
>          # same data will be placed in list and string for manipulation
>          l_boot_time = check_match.split(" ")[-2:]
>          s_boot_time = " ".join(l_boot_time)
> -        # Obtain the minutes it took to boot
> -        if l_boot_time[0].endswith('min') and l_boot_time[0][0].isdigit():
> -            boot_time_min = s_boot_time.split("min")[0]
> -            # convert to seconds and accumulate it
> -            boot_time_sec += int(boot_time_min) * 60
> -        # Obtain the seconds it took to boot and accumulate
> -        boot_time_sec += float(l_boot_time[1].split("s")[0])
> +        try:
> +            # Obtain the minutes it took to boot
> +            if l_boot_time[0].endswith('min') and l_boot_time[0][0].isdigit():
> +                boot_time_min = s_boot_time.split("min")[0]
> +                # convert to seconds and accumulate it
> +                boot_time_sec += int(boot_time_min) * 60
> +            # Obtain the seconds it took to boot and accumulate
> +            boot_time_sec += float(l_boot_time[1].split("s")[0])

is float right to use here I wonder,

> +        except ValueError:
> +            self.skipTest("Error when parsing time from boot string")
>          #Assert the target boot time against systemd's unit start timeout
>          if boot_time_sec > systemd_TimeoutStartSec:
>              print "Target boot time %s exceeds systemd's TimeoutStartSec %s"\
> --
> 2.5.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] runtime/systemd: Fix for boot time string parse error
  2016-02-01 18:48 ` Khem Raj
@ 2016-02-15 17:32   ` Benjamin Esquivel
  2016-02-15 19:53     ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Esquivel @ 2016-02-15 17:32 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On Mon, 2016-02-01 at 10:48 -0800, Khem Raj wrote:
> On Mon, Feb 1, 2016 at 7:53 AM, Benjamin Esquivel
> <benjamin.esquivel@linux.intel.com> wrote:
> > boot time string can change its format of the output of the amount
> > of time
> > it took to boot. It is required to handle graceful fail of the
> > parsing
> > errors that it provokes
> > 
> > [YOCTO #8889]
> > 
> > Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com
> > >
> > ---
> >  meta/lib/oeqa/runtime/systemd.py | 22 ++++++++++++----------
> >  1 file changed, 12 insertions(+), 10 deletions(-)
> > 
> > diff --git a/meta/lib/oeqa/runtime/systemd.py
> > b/meta/lib/oeqa/runtime/systemd.py
> > index 03c56ef..2b2f10d 100644
> > --- a/meta/lib/oeqa/runtime/systemd.py
> > +++ b/meta/lib/oeqa/runtime/systemd.py
> > @@ -145,8 +145,7 @@ class SystemdJournalTests(SystemdTest):
> >          except AssertionError:
> >              self.fail("Error occurred while calling journalctl")
> >          if not len(output):
> > -            self.fail("Error: unable to obtain the startup time
> > from\
> > -                    systemd journal")
> > +            self.fail("Error, unable to get startup time from
> > systemd journal")
> > 
> >          # check for the regular expression items that match the
> > startup time
> >          for line in output.split('\n'):
> > @@ -156,20 +155,23 @@ class SystemdJournalTests(SystemdTest):
> >          if check_match:
> >              print "%s" % check_match
> >          else:
> > -            self.fail("Error while obtaining the boot time from
> > journalctl")
> > +            self.skipTest("Error at obtaining the boot time from
> > journalctl")
> >          boot_time_sec = 0
> > 
> >          # get the numeric values from the string and convert them
> > to seconds
> >          # same data will be placed in list and string for
> > manipulation
> >          l_boot_time = check_match.split(" ")[-2:]
> >          s_boot_time = " ".join(l_boot_time)
> > -        # Obtain the minutes it took to boot
> > -        if l_boot_time[0].endswith('min') and
> > l_boot_time[0][0].isdigit():
> > -            boot_time_min = s_boot_time.split("min")[0]
> > -            # convert to seconds and accumulate it
> > -            boot_time_sec += int(boot_time_min) * 60
> > -        # Obtain the seconds it took to boot and accumulate
> > -        boot_time_sec += float(l_boot_time[1].split("s")[0])
> > +        try:
> > +            # Obtain the minutes it took to boot
> > +            if l_boot_time[0].endswith('min') and
> > l_boot_time[0][0].isdigit():
> > +                boot_time_min = s_boot_time.split("min")[0]
> > +                # convert to seconds and accumulate it
> > +                boot_time_sec += int(boot_time_min) * 60
> > +            # Obtain the seconds it took to boot and accumulate
> > +            boot_time_sec += float(l_boot_time[1].split("s")[0])
> 
> is float right to use here I wonder,
float is what the seconds are expressed in at the journal, like in:

systemd[1]: Startup finished in 1.616s (kernel) + 13.561s (initrd) +
3.195s (userspace) = 26.632s
 
> > +        except ValueError:
> > +            self.skipTest("Error when parsing time from boot
> > string")
> >          #Assert the target boot time against systemd's unit start
> > timeout
> >          if boot_time_sec > systemd_TimeoutStartSec:
> >              print "Target boot time %s exceeds systemd's
> > TimeoutStartSec %s"\
> > --
> > 2.5.1
> > 
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] runtime/systemd: Fix for boot time string parse error
  2016-02-15 17:32   ` Benjamin Esquivel
@ 2016-02-15 19:53     ` Khem Raj
  0 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2016-02-15 19:53 UTC (permalink / raw)
  To: Benjamin Esquivel; +Cc: Patches and discussions about the oe-core layer

On Mon, Feb 15, 2016 at 9:32 AM, Benjamin Esquivel
<benjamin.esquivel@linux.intel.com> wrote:
> On Mon, 2016-02-01 at 10:48 -0800, Khem Raj wrote:
>> On Mon, Feb 1, 2016 at 7:53 AM, Benjamin Esquivel
>> <benjamin.esquivel@linux.intel.com> wrote:
>> > boot time string can change its format of the output of the amount
>> > of time
>> > it took to boot. It is required to handle graceful fail of the
>> > parsing
>> > errors that it provokes
>> >
>> > [YOCTO #8889]
>> >
>> > Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com
>> > >
>> > ---
>> >  meta/lib/oeqa/runtime/systemd.py | 22 ++++++++++++----------
>> >  1 file changed, 12 insertions(+), 10 deletions(-)
>> >
>> > diff --git a/meta/lib/oeqa/runtime/systemd.py
>> > b/meta/lib/oeqa/runtime/systemd.py
>> > index 03c56ef..2b2f10d 100644
>> > --- a/meta/lib/oeqa/runtime/systemd.py
>> > +++ b/meta/lib/oeqa/runtime/systemd.py
>> > @@ -145,8 +145,7 @@ class SystemdJournalTests(SystemdTest):
>> >          except AssertionError:
>> >              self.fail("Error occurred while calling journalctl")
>> >          if not len(output):
>> > -            self.fail("Error: unable to obtain the startup time
>> > from\
>> > -                    systemd journal")
>> > +            self.fail("Error, unable to get startup time from
>> > systemd journal")
>> >
>> >          # check for the regular expression items that match the
>> > startup time
>> >          for line in output.split('\n'):
>> > @@ -156,20 +155,23 @@ class SystemdJournalTests(SystemdTest):
>> >          if check_match:
>> >              print "%s" % check_match
>> >          else:
>> > -            self.fail("Error while obtaining the boot time from
>> > journalctl")
>> > +            self.skipTest("Error at obtaining the boot time from
>> > journalctl")
>> >          boot_time_sec = 0
>> >
>> >          # get the numeric values from the string and convert them
>> > to seconds
>> >          # same data will be placed in list and string for
>> > manipulation
>> >          l_boot_time = check_match.split(" ")[-2:]
>> >          s_boot_time = " ".join(l_boot_time)
>> > -        # Obtain the minutes it took to boot
>> > -        if l_boot_time[0].endswith('min') and
>> > l_boot_time[0][0].isdigit():
>> > -            boot_time_min = s_boot_time.split("min")[0]
>> > -            # convert to seconds and accumulate it
>> > -            boot_time_sec += int(boot_time_min) * 60
>> > -        # Obtain the seconds it took to boot and accumulate
>> > -        boot_time_sec += float(l_boot_time[1].split("s")[0])
>> > +        try:
>> > +            # Obtain the minutes it took to boot
>> > +            if l_boot_time[0].endswith('min') and
>> > l_boot_time[0][0].isdigit():
>> > +                boot_time_min = s_boot_time.split("min")[0]
>> > +                # convert to seconds and accumulate it
>> > +                boot_time_sec += int(boot_time_min) * 60
>> > +            # Obtain the seconds it took to boot and accumulate
>> > +            boot_time_sec += float(l_boot_time[1].split("s")[0])
>>
>> is float right to use here I wonder,
> float is what the seconds are expressed in at the journal, like in:
>
> systemd[1]: Startup finished in 1.616s (kernel) + 13.561s (initrd) +
> 3.195s (userspace) = 26.632s
>

so its in 100th thats ok,.

>> > +        except ValueError:
>> > +            self.skipTest("Error when parsing time from boot
>> > string")
>> >          #Assert the target boot time against systemd's unit start
>> > timeout
>> >          if boot_time_sec > systemd_TimeoutStartSec:
>> >              print "Target boot time %s exceeds systemd's
>> > TimeoutStartSec %s"\
>> > --
>> > 2.5.1
>> >
>> > --
>> > _______________________________________________
>> > Openembedded-core mailing list
>> > Openembedded-core@lists.openembedded.org
>> > http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-15 19:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 15:53 [PATCH] runtime/systemd: Fix for boot time string parse error Benjamin Esquivel
2016-02-01 18:48 ` Khem Raj
2016-02-15 17:32   ` Benjamin Esquivel
2016-02-15 19:53     ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.