[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [OSSTEST PATCH 01/25] Osstest.pm: Provide new db_prepare helper with built-in debugging



Ian Jackson writes ("[OSSTEST PATCH 01/25] Osstest.pm: Provide new db_prepare 
helper with built-in debugging"):
> No callers, so no functional change, as yet.

> +sub db_prepare ($) {
> +    # caller must ensure global filehandle DEBUG is open
> +    my ($stmt) = @_;
> +    print ::DEBUG "DB PREPARING:\n$stmt\n";
> +    return $dbh_tests->prepare($stmt);

This generates:

Name "main::DEBUG" used only once: possible typo at Osstest.pm line
274.

Here is a v2 of this patch which fixes it.

Ian.

commit bd7cf4f0f1a8c45d840528bc28dbd89b34732d7a
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Fri May 29 13:19:39 2015 +0000

    Osstest.pm: Provide new db_prepare helper with built-in debugging
    
    No callers, so no functional change, as yet.
    
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    ---
    v2: Suppress "used only once" warning

diff --git a/Osstest.pm b/Osstest.pm
index e8bd77b..8948666 100644
--- a/Osstest.pm
+++ b/Osstest.pm
@@ -35,7 +35,7 @@ BEGIN {
                       getmethod
                       postfork
                       $dbh_tests db_retry db_retry_retry db_retry_abort
-                      db_begin_work
+                      db_begin_work db_prepare
                       ensuredir get_filecontents_core_quiet system_checked
                       nonempty visible_undef show_abs_time
                       );
@@ -49,6 +49,10 @@ our $mjobdb;
 
 our $dbh_tests;
 
+scalar *main::DEBUG;
+# declaration prevents `Name "main::DEBUG" used only once'
+# scalar prevents `useless use of a variable in void context'
+
 #---------- static default config settings ----------
 
 our %c = qw(
@@ -268,6 +272,13 @@ sub db_retry ($$$;$$) {
     return $r;
 }
 
+sub db_prepare ($) {
+    # caller must ensure global filehandle DEBUG is open
+    my ($stmt) = @_;
+    print ::DEBUG "DB PREPARING:\n$stmt\n";
+    return $dbh_tests->prepare($stmt);
+}
+
 sub postfork () {
     $mjobdb->jobdb_postfork();
 }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.