From f4d5049b5d74cf907c5c5bba3130306adff0205d Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Sat, 29 Nov 2008 16:43:41 -0500 Subject: buildrun/caching warning cleanup --- ChangeLog | 11 +++++++++++ buildrun.cxx | 10 +++------- cache.cxx | 17 ++++++++++++----- hash.cxx | 7 ++++--- main.cxx | 21 ++++++++++++++------- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 102cf733..80cb6b3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-11-29 Frank Ch. Eigler + + Warnings cleanup. + * buildrun.cxx (verify_uprobes_uptodate, make_uprobes): Simplify + messages. + * cache.cxx (add_to_cache, clean_cache): Reset s.use_cache upon + failure. + * hash.cxx (find_hash): Ditto. + * main.cxx (main): Simplify/conditionalize warning messages. Save + module to $cwd if last_pass==4 but cache encountered errors. + 2008-11-28 Frank Ch. Eigler PR 6965. diff --git a/buildrun.cxx b/buildrun.cxx index ef2a483f..f9588906 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -201,7 +201,7 @@ verify_uprobes_uptodate (systemtap_session& s) int rc = run_make_cmd(s, make_cmd); if (rc) { clog << "SystemTap's version of uprobes is out of date." << endl; - clog << "As root, run \"make\" in " << uprobes_home << "." << endl; + clog << "As root, run \"make -C " << uprobes_home << "\"." << endl; } return rc; @@ -217,12 +217,8 @@ make_uprobes (systemtap_session& s) string make_cmd = string("make -C ") + uprobes_home; int rc = run_make_cmd(s, make_cmd); - if (s.verbose) { - if (rc) - clog << "Uprobes (re)build failed." << endl; - else - clog << "Uprobes (re)build complete." << endl; - } + if (s.verbose > 1) + clog << "uprobes rebuild rc=" << rc << endl; return rc; } diff --git a/cache.cxx b/cache.cxx index acab0b84..b1d3aa8a 100644 --- a/cache.cxx +++ b/cache.cxx @@ -35,6 +35,7 @@ add_to_cache(systemtap_session& s) { cerr << "Copy failed (\"" << module_src_path << "\" to \"" << s.hash_path << "\"): " << strerror(errno) << endl; + s.use_cache = false; return; } @@ -48,8 +49,13 @@ add_to_cache(systemtap_session& s) << endl; if (copy_file(s.translated_source.c_str(), c_dest_path.c_str()) != 0) { - cerr << "Copy failed (\"" << s.translated_source << "\" to \"" - << c_dest_path << "\"): " << strerror(errno) << endl; + if (s.verbose > 1) + cerr << "Copy failed (\"" << s.translated_source << "\" to \"" + << c_dest_path << "\"): " << strerror(errno) << endl; + // NB: this is not so severe as to prevent reuse of the .ko + // already copied. + // + // s.use_cache = false; } clean_cache(s); @@ -219,9 +225,10 @@ clean_cache(systemtap_session& s) if (s.verbose > 1 && removed_dirs != "") { - //remove trailing ", " - removed_dirs = removed_dirs.substr(0, removed_dirs.length() - 2); - clog << "Cache cleaning successful, removed entries: " << removed_dirs << endl; + //remove trailing ", " + removed_dirs = removed_dirs.substr(0, removed_dirs.length() - 2); + clog << "Cache cleaning successful, removed entries: " + << removed_dirs << endl; } } else diff --git a/hash.cxx b/hash.cxx index 45039391..a10815c9 100644 --- a/hash.cxx +++ b/hash.cxx @@ -161,9 +161,10 @@ find_hash (systemtap_session& s, const string& script) hashdir += string("/") + result[i*2] + result[i*2 + 1]; if (create_dir(hashdir.c_str()) != 0) { - cerr << "Warning: failed to create cache directory (\"" - << hashdir + "\"): " << strerror(errno) << endl; - cerr << "Disabling cache support." << endl; + if (! s.suppress_warnings) + cerr << "Warning: failed to create cache directory (\"" + << hashdir + "\"): " << strerror(errno) + << ", disabling cache support." << endl; s.use_cache = false; return; } diff --git a/main.cxx b/main.cxx index 91c20ddb..9d322fe4 100644 --- a/main.cxx +++ b/main.cxx @@ -393,9 +393,10 @@ main (int argc, char * const argv []) if (create_dir(s.data_path.c_str()) == 1) { const char* e = strerror (errno); - cerr << "Warning: failed to create systemtap data directory (\"" - << s.data_path << "\"): " << e << endl; - cerr << "Disabling cache support." << endl; + if (! s.suppress_warnings) + cerr << "Warning: failed to create systemtap data directory (\"" + << s.data_path << "\"): " << e + << ", disabling cache support." << endl; s.use_cache = false; } @@ -405,9 +406,10 @@ main (int argc, char * const argv []) if (create_dir(s.cache_path.c_str()) == 1) { const char* e = strerror (errno); - cerr << "Warning: failed to create cache directory (\"" - << s.cache_path << "\"): " << e << endl; - cerr << "Disabling cache support." << endl; + if (! s.suppress_warnings) + cerr << "Warning: failed to create cache directory (\"" + << s.cache_path << "\"): " << e + << ", disabling cache support." << endl; s.use_cache = false; } } @@ -1062,8 +1064,13 @@ main (int argc, char * const argv []) { // Update cache. Cache cleaning is kicked off at the end of this function. if (s.use_cache) - add_to_cache(s); + add_to_cache(s); + // We may need to save the module in $CWD if the cache was + // inaccessible for some reason. + if (! s.use_cache && s.last_pass == 4) + save_module = true; + // Copy module to the current directory. if (save_module && !pending_interrupts) { -- cgit