autotest: shill: improve failure message for DefaultProfileCreation

When the network_DefaultProfileCreation fails, it reports the missing
setting. We don't know whether just that specific setting was missing,
or if the entire file was empty. Help answer this question, by including
the full contents of the default profile, when the test fails.

TEST=manual (see below)

Manual test
- modify network_DefaultProfileCreation by adding a bogus setting
- see that the test output includes the contents of the default

Change-Id: I1c1823475a92238b4836f6d357f5828bbbdfcdb2
Tested-by: mukesh agrawal <>
Reviewed-by: Paul Stewart <>
Commit-Queue: mukesh agrawal <>
diff --git a/client/site_tests/network_DefaultProfileCreation/ b/client/site_tests/network_DefaultProfileCreation/
index 450438e..9349634 100644
--- a/client/site_tests/network_DefaultProfileCreation/
+++ b/client/site_tests/network_DefaultProfileCreation/
@@ -2,6 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
+import logging
 import os
 from autotest_lib.client.bin import test
@@ -46,4 +47,6 @@
         profile = open(self.DEFAULT_PROFILE_PATH).read()
         for setting in self.EXPECTED_SETTINGS:
             if setting not in profile:
-                raise error.TestFail('Missing setting ' + setting)
+                logging.error('Did not find setting %s', setting)
+                logging.error('Full profile contents are:\n%s', profile)
+                raise error.TestFail('Missing setting(s) in default profile.')