На 13.02.2014 17:57, Chris Lumens написа:
Are you OK with activating coverage when 'debug=1' is passed on the
boot command line or should I add a 'coverage' parameter ?
I'm fine with using the debug parameter for this. We've got too many
parameters already, so I don't like adding new ones unless we absolutely
need to.
How about the hard-coded path I'm using ? Any suggestions for that?
I don't have a better suggestion, though putting stuff in root's home
directory seems a little bit weird. I suppose if it only happens when
debug=1 is set, you can say the user asked for it.
Here's a patch against master. Two things to note:
* It adds Requires: python-coverage to the spec file which if I understand
correctly will pull all the necessary requirements when lorax builds the install
images;
* I do a quick check of /proc/cmdline contents for "debug=1" and not use any
other method to do so b/c my goal is to start coverage as early as possible and
not import other modules before that; In my testing this works fine.
I can give it a try on a Rawhide snapshot once it goes in. Just let me know in
which package version.
--
Alex
diff --git a/anaconda b/anaconda
index 994497f..ef415bb 100755
--- a/anaconda
+++ b/anaconda
@@ -31,11 +31,29 @@
# This toplevel file is a little messy at the moment... (2001-06-22)
# ...still messy (2013-07-12)
+coverage = None
+
+proc_cmdline = open("/proc/cmdline", "r").read()
+if proc_cmdline.find("debug=1") > -1:
+ import coverage
+ cov = coverage.coverage(data_file="/mnt/sysimage/root/anaconda.coverage",
+ branch=True,
+ source=["/usr/sbin/anaconda", "pyanaconda"]
+ )
+ cov.start()
+
+
import atexit, sys, os, time, subprocess
# keep up with process ID of the window manager if we start it
wm_pid = None
def exitHandler(rebootData, storage, exitCode=None):
+ # stop and save coverage here b/c later the file system may be unavailable
+ if coverage is not None:
+ cov.stop()
+ if os.path.isdir('/mnt/sysimage/root'):
+ cov.save()
+
if flags.usevnc:
vnc.shutdownServer()
diff --git a/anaconda.spec.in b/anaconda.spec.in
index 406c8f0..58dc917 100755
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -142,6 +142,8 @@ Requires: hfsplus-tools
%endif
%endif
+Requires: python-coverage
+
# required because of the rescue mode and VNC question
Requires: anaconda-tui = %{version}-%{release}
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list