tests: Build the input file into the initest unit test.

This breaks an external dependency and makes the expected command line
conform to the other unit tests. Also get rid of some ancient tests
which test adding to the ini's contents based on command line
arguments.

This test still needs to be modified so that it actually checks whether
what happened was correct.

Change-Id: I2c9ea9fa79781bceb5cd3d1419870924e8bbd45f
Reviewed-on: https://gem5-review.googlesource.com/6081
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
diff --git a/src/unittest/initest.cc b/src/unittest/initest.cc
index 7e103aa..222fcab 100644
--- a/src/unittest/initest.cc
+++ b/src/unittest/initest.cc
@@ -39,72 +39,35 @@
 
 using namespace std;
 
-char *progname;
+namespace {
 
-void usage();
+std::istringstream iniFile(R"ini_file(
+[General]
+   Test1=BARasdf
+   Test2=bar
 
-void
-usage()
-{
-    cout << "Usage: " << progname << " <ini file>\n";
-    exit(1);
-}
+[Junk]
+Test3=yo
+Test4=mama
 
-#if 0
-char *defines = getenv("CONFIG_DEFINES");
-if (defines) {
-    char *c = defines;
-    while ((c = strchr(c, ' ')) != NULL) {
-        *c++ = '\0';
-        count++;
-    }
-    count++;
-}
+[Foo]
+Foo1=89
+Foo2=384
 
-#endif
+[General]
+Test3=89
+
+[Junk]
+Test4+=mia
+)ini_file");
+
+};
 
 int
 main(int argc, char *argv[])
 {
     IniFile simConfigDB;
-
-    progname = argv[0];
-
-    for (int i = 1; i < argc; ++i) {
-        char *arg_str = argv[i];
-
-        // if arg starts with '-', parse as option,
-        // else treat it as a configuration file name and load it
-        if (arg_str[0] == '-') {
-            // switch on second char
-            switch (arg_str[1]) {
-              case '-':
-                // command-line configuration parameter:
-                // '--<section>:<parameter>=<value>'
-
-                if (!simConfigDB.add(arg_str + 2)) {
-                    // parse error
-                    ccprintf(cerr,
-                             "Could not parse configuration argument '%s'\n"
-                             "Expecting --<section>:<parameter>=<value>\n",
-                             arg_str);
-                    exit(0);
-                }
-                break;
-
-              default:
-                usage();
-            }
-        }
-        else {
-            // no '-', treat as config file name
-
-            if (!simConfigDB.load(arg_str)) {
-                cprintf("Error processing file %s\n", arg_str);
-                exit(1);
-            }
-        }
-    }
+    simConfigDB.load(iniFile);
 
     string value;
 
diff --git a/src/unittest/initest.ini b/src/unittest/initest.ini
deleted file mode 100644
index 212c790..0000000
--- a/src/unittest/initest.ini
+++ /dev/null
@@ -1,17 +0,0 @@
-[General]
-   Test1=BARasdf
-   Test2=bar
-
-[Junk]
-Test3=yo
-Test4=mama
-
-[Foo]
-Foo1=89
-Foo2=384
-
-[General]
-Test3=89
-
-[Junk]
-Test4+=mia