[augeas-devel] strange test failure

Jennings, Jared L CTR USAF AFMC 46 SK/CCI jared.jennings.ctr at eglin.af.mil
Mon Feb 7 17:59:39 UTC 2011


(Sorry if this isn't the right depth of question for this list: I
haven't found an augeas-users list)

I'm working on a lens for Upstart init files. I have a bunch of tests,
culminating with a test that tries to parse
/etc/init/kexec-disable.conf. When that test runs, it fails, but the
actual and expected results are the same! How can I fix a test that
doesn't appear to be broken?


My test looks a-like so:

    test lns get "
# On machines where kexec isn't going to be used, free the memory
reserved for it.

start on stopped rcS
task

script
        if [ ! -x /sbin/kexec ] || ! chkconfig kdump 2>/dev/null ; then
                echo -n \"0\" > /sys/kernel/kexec_crash_size 2>/dev/null
        fi
        exit 0
end script
" =
(
  {  }
  { "#comment" = "On machines where kexec isn't going to be used, free
the memory reserved for it." }
  {  }
  { "start" = "on stopped rcS" }
  { "task" }
  {  }
  { "script"
    { "1" = "   if [ ! -x /sbin/kexec ] || ! chkconfig kdump 2>/dev/null
; then" }
    { "2" = "           echo -n \"0\" > /sys/kernel/kexec_crash_size
2>/dev/null" }
    { "3" = "   fi" }
    { "4" = "   exit 0" }
  }
)


And my results look a-like so: 

Test failure:upstartinit.aug:86.4-112.1:
 Expected:
{ 
  {  }
  { "#comment" = "On machines where kexec isn't going to be used, free
the memory reserved for it." }
  {  }
  { "start" = "on stopped rcS" }
  { "task" }
  {  }
  { "script"
    { "1" = "   if [ ! -x /sbin/kexec ] || ! chkconfig kdump 2>/dev/null
; then" }
    { "2" = "           echo -n "0" > /sys/kernel/kexec_crash_size
2>/dev/null" }
    { "3" = "   fi" }
    { "4" = "   exit 0" }
  }
}

 Actual:
{ 
  {  }
  { "#comment" = "On machines where kexec isn't going to be used, free
the memory reserved for it." }
  {  }
  { "start" = "on stopped rcS" }
  { "task" }
  {  }
  { "script"
    { "1" = "   if [ ! -x /sbin/kexec ] || ! chkconfig kdump 2>/dev/null
; then" }
    { "2" = "           echo -n "0" > /sys/kernel/kexec_crash_size
2>/dev/null" }
    { "3" = "   fi" }
    { "4" = "   exit 0" }
  }
}

No error





More information about the augeas-devel mailing list