lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r467767 - in /lucene/lucy/trunk: charmonizer/charmonize.c perl/buildlib/Lucy/Build.pm
Date Wed, 25 Oct 2006 21:07:11 GMT
Author: marvin
Date: Wed Oct 25 14:07:11 2006
New Revision: 467767

URL: http://svn.apache.org/viewvc?view=rev&rev=467767
Log:
Improve debuggability: when the environment variable DEBUG_CHARM is set, pass
extra flags to Charmonizer (which in turn get passed to every test compile),
and goose up the verbosity level to 2.

Modified:
    lucene/lucy/trunk/charmonizer/charmonize.c
    lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm

Modified: lucene/lucy/trunk/charmonizer/charmonize.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/charmonize.c?view=diff&rev=467767&r1=467766&r2=467767
==============================================================================
--- lucene/lucy/trunk/charmonizer/charmonize.c (original)
+++ lucene/lucy/trunk/charmonizer/charmonize.c Wed Oct 25 14:07:11 2006
@@ -25,6 +25,12 @@
 static char*
 extract_delim(char *source, size_t source_len, const char *tag_name);
 
+/* Version of extract delim which dies rather than returns NULL upon failure.
+ */
+static char*
+extract_delim_and_verify(char *source, size_t source_len, 
+                         const char *tag_name);
+
 /* Start the config file.
  */
 static void 
@@ -63,7 +69,7 @@
 FILE* 
 init(int argc, char **argv) 
 {
-    char *outpath, *cc_command, *cc_flags, *os_name;
+    char *outpath, *cc_command, *cc_flags, *os_name, *verbosity_str;
     char *infile_str;
     size_t infile_len;
     FILE *conf_fh;
@@ -72,11 +78,16 @@
     if (argc != 2)
         die("Usage: ./charmonize INFILE");
     infile_str = chaz_slurp_file(argv[1], &infile_len);
-    cc_command = extract_delim(infile_str, infile_len, "charm_cc_command");
-    cc_flags   = extract_delim(infile_str, infile_len, "charm_cc_flags");
-    outpath    = extract_delim(infile_str, infile_len, "charm_outpath");
-    os_name    = extract_delim(infile_str, infile_len, "charm_os_name");
-    
+    cc_command = extract_delim_and_verify(infile_str, infile_len, 
+        "charm_cc_command");
+    cc_flags = extract_delim_and_verify(infile_str, infile_len, 
+        "charm_cc_flags");
+    outpath = extract_delim_and_verify(infile_str, infile_len, 
+        "charm_outpath");
+    os_name = extract_delim_and_verify(infile_str, infile_len, 
+        "charm_os_name");
+    verbosity_str = extract_delim(infile_str, infile_len, "charm_verbosity");
+
     /* open outfile */
     conf_fh = fopen(outpath, "w");
     if (conf_fh == NULL)
@@ -84,6 +95,10 @@
     start_conf_file(conf_fh);
 
     /* set up Charmonizer */
+    if (verbosity_str != NULL) {
+        const long verbosity = strtol(verbosity_str, NULL, 10);
+        chaz_set_verbosity(verbosity);
+    }
     chaz_init(os_name, cc_command, cc_flags);
     chaz_set_prefixes("LUCY_", "Lucy_", "lucy_", "lucy_");
     chaz_write_charm_test_h();
@@ -134,10 +149,16 @@
             break;
         }
     }
+    
+    return retval;
+}
 
+static char*
+extract_delim_and_verify(char *source, size_t source_len, const char *tag_name)
+{
+    char *retval = extract_delim(source, source_len, tag_name);
     if (retval == NULL)
         die("Couldn't extract value for '%s'", tag_name);
-    
     return retval;
 }
 

Modified: lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm?view=diff&rev=467767&r1=467766&r2=467767
==============================================================================
--- lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm Wed Oct 25 14:07:11 2006
@@ -153,13 +153,16 @@
 
     # write the infile with which to communicate args to charmonize
     my $os_name = lc( $Config{osname} );
+    my $flags = "$Config{ccflags} $EXTRA_CCFLAGS";
+    my $verbosity = $ENV{DEBUG_CHARM} ? 2 : 1;
     open( my $infile_fh, '>', $lucyconf_in )
         or die "Can't open '$lucyconf_in': $!";
     print $infile_fh qq|
         <charm_outpath>$lucyconf_path</charm_outpath>
         <charm_os_name>$os_name</charm_os_name>
         <charm_cc_command>$Config{cc}</charm_cc_command>
-        <charm_cc_flags>$Config{ccflags}</charm_cc_flags>
+        <charm_cc_flags>$flags</charm_cc_flags>
+        <charm_verbosity>$verbosity</charm_verbosity>
     |;
     close $infile_fh or die "Can't close '$lucyconf_in': $!";
 



Mime
View raw message