summaryrefslogtreecommitdiff
path: root/src/unittest
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-04-06 10:19:36 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-04-06 10:19:36 -0700
commitd080581db1f9ee4e1e6d07d2b01c13c67908a391 (patch)
treecc484b289fa5a30c4631f9faa1d8b456bffeebfc /src/unittest
parent7a7c4c5fca83a8d47c7e71c9c080a882ebe204a9 (diff)
parent639cb0a42d953ee32bc7e96b0cdfa96cd40e9fc1 (diff)
downloadgem5-d080581db1f9ee4e1e6d07d2b01c13c67908a391.tar.xz
Merge ARM into the head. ARM will compile but may not actually work.
Diffstat (limited to 'src/unittest')
-rw-r--r--src/unittest/Makefile101
-rw-r--r--src/unittest/SConscript48
-rw-r--r--src/unittest/bitvectest.cc53
-rw-r--r--src/unittest/circletest.cc58
-rw-r--r--src/unittest/cprintftest.cc18
-rw-r--r--src/unittest/foo.ini1
-rw-r--r--src/unittest/initest.cc20
-rw-r--r--src/unittest/initest.ini14
-rw-r--r--src/unittest/lru_test.cc85
-rw-r--r--src/unittest/nmtest.cc3
-rw-r--r--src/unittest/offtest.cc72
-rw-r--r--src/unittest/paramtest.cc107
-rw-r--r--src/unittest/rangemaptest.cc3
-rw-r--r--src/unittest/rangemultimaptest.cc (renamed from src/unittest/rangemaptest2.cc)14
-rw-r--r--src/unittest/rangetest.cc57
-rw-r--r--src/unittest/sized_test.cc70
-rw-r--r--src/unittest/stattest.cc135
-rw-r--r--src/unittest/strnumtest.cc63
-rw-r--r--src/unittest/symtest.cc4
-rw-r--r--src/unittest/tracetest.cc56
20 files changed, 267 insertions, 715 deletions
diff --git a/src/unittest/Makefile b/src/unittest/Makefile
deleted file mode 100644
index e6a621a9e..000000000
--- a/src/unittest/Makefile
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright (c) 2006-2007 The Regents of The University of Michigan
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met: redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer;
-# redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution;
-# neither the name of the copyright holders nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors: Nathan Binkert
-# Steve Reinhardt
-
-CC?= gcc
-CXX?= g++
-PYTHON?=/usr/bin/env python
-
-CURDIR?= $(shell /bin/pwd)
-SRCDIR?= $(CURDIR)/..
-
-CCFLAGS= -g -O0 -MMD -I. -I$(SRCDIR) -I- -DTRACING_ON=0
-MYSQL= -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
-
-VPATH=$(SRCDIR):$(CURDIR)
-
-default:
- @echo "You must specify a target"
-
-base/traceflags.cc base/traceflags.hh: $(SRCDIR)/base/traceflags.py
- mkdir -p base; \
- cd base; \
- $(PYTHON) $<
-
-bitvectest: unittest/bitvectest.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-circletest: unittest/circletest.cc base/circlebuf.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-cprintftest: unittest/cprintftest.cc base/cprintf.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-cprintftime: unittest/cprintftime.cc base/cprintf.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-initest: unittest/initest.cc base/str.cc base/inifile.cc base/cprintf.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-lrutest: unittest/lru_test.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-nmtest: unittest/nmtest.cc base/output.cc base/hostinfo.cc base/cprintf.cc base/misc.cc base/loader/object_file.cc base/loader/symtab.cc base/misc.cc base/str.cc base/loader/aout_object.cc base/loader/ecoff_object.cc base/loader/elf_object.cc
- $(CXX) $(CCFLAGS) -I/n/ziff/z/binkertn/build/work/ALPHA_FS -lelf -o $@ $^
-
-offtest: unittest/offtest.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-rangetest: unittest/rangetest.cc base/range.cc base/str.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-STATTEST+= base/cprintf.cc base/hostinfo.cc base/misc.cc base/mysql.cc
-STATTEST+= base/python.cc base/str.cc base/time.cc
-STATTEST+= base/statistics.cc base/stats/mysql.cc base/stats/python.cc
-STATTEST+= base/stats/statdb.cc base/stats/text.cc base/stats/visit.cc
-STATTEST+= unittest/stattest.cc
-stattest: $(STATTEST)
- $(CXX) $(CCFLAGS) $(MYSQL) -o $@ $^
-
-strnumtest: unittest/strnumtest.cc base/str.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-symtest: unittest/symtest.cc base/misc.cc base/symtab.cc base/str.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-tokentest: unittest/tokentest.cc base/str.cc
- $(CXX) $(CCFLAGS) -o $@ $^
-
-TRACE+=unittest/tracetest.cc base/trace.cc base/trace_flags.cc base/cprintf.cc
-TRACE+=base/str.cc base/misc.cc
-tracetest: $(TRACE)
- $(CXX) $(CCFLAGS) -o $@ $^
-
-clean:
- @rm -rf *test *~ .#* *.core core base
-.PHONY: clean
diff --git a/src/unittest/SConscript b/src/unittest/SConscript
new file mode 100644
index 000000000..1c1959165
--- /dev/null
+++ b/src/unittest/SConscript
@@ -0,0 +1,48 @@
+# -*- mode:python -*-
+
+# Copyright (c) 2004-2005 The Regents of The University of Michigan
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Nathan Binkert
+
+Import('*')
+
+UnitTest('bitvectest', 'bitvectest.cc')
+UnitTest('circletest', 'circletest.cc')
+UnitTest('cprintftest', 'cprintftest.cc')
+UnitTest('cprintftime', 'cprintftest.cc')
+UnitTest('initest', 'initest.cc')
+UnitTest('lrutest', 'lru_test.cc')
+UnitTest('nmtest', 'nmtest.cc')
+UnitTest('offtest', 'offtest.cc')
+UnitTest('rangetest', 'rangetest.cc')
+UnitTest('rangemaptest', 'rangemaptest.cc')
+UnitTest('rangemultimaptest', 'rangemultimaptest.cc')
+UnitTest('stattest', 'stattest.cc')
+UnitTest('strnumtest', 'strnumtest.cc')
+UnitTest('symtest', 'symtest.cc')
+UnitTest('tokentest', 'tokentest.cc')
+UnitTest('tracetest', 'tracetest.cc')
diff --git a/src/unittest/bitvectest.cc b/src/unittest/bitvectest.cc
index 440a150a3..29069081b 100644
--- a/src/unittest/bitvectest.cc
+++ b/src/unittest/bitvectest.cc
@@ -28,41 +28,42 @@
* Authors: Nathan Binkert
*/
-#include <iostream.h>
-
+#include <iostream>
#include <vector>
+using namespace std;
+
int
main()
{
- vector<bool> v1(100);
+ vector<bool> v1(100);
- v1[0] = true;
- v1.resize(500);
- v1[100] = true;
- v1[499] = true;
- v1.resize(10000);
- v1[9999] = true;
+ v1[0] = true;
+ v1.resize(500);
+ v1[100] = true;
+ v1[499] = true;
+ v1.resize(10000);
+ v1[9999] = true;
- cout << "v1.size() = " << v1.size() << "\n";
- for (int i = 0; i < v1.size(); i++)
- if (v1[i])
- cout << "v1[" << i << "] = " << v1[i] << "\n";
+ cout << "v1.size() = " << v1.size() << "\n";
+ for (int i = 0; i < v1.size(); i++)
+ if (v1[i])
+ cout << "v1[" << i << "] = " << v1[i] << "\n";
- cout << "\n";
+ cout << "\n";
- vector<bool> v2 = v1;
+ vector<bool> v2 = v1;
- for (int i = 0; i < v2.size(); i++)
- if (v2[i])
- cout << "v2[" << i << "] = " << v2[i] << "\n";
+ for (int i = 0; i < v2.size(); i++)
+ if (v2[i])
+ cout << "v2[" << i << "] = " << v2[i] << "\n";
- cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
- v2[8583] = true;
- cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
- v1[8583] = true;
- cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
- v1.resize(100000);
- cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
- cout << flush;
+ cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
+ v2[8583] = true;
+ cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
+ v1[8583] = true;
+ cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
+ v1.resize(100000);
+ cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
+ cout << flush;
}
diff --git a/src/unittest/circletest.cc b/src/unittest/circletest.cc
index f072cf044..2ee75b6df 100644
--- a/src/unittest/circletest.cc
+++ b/src/unittest/circletest.cc
@@ -29,19 +29,21 @@
*/
#include <fcntl.h>
-#include <iostream.h>
#include <unistd.h>
+#include <iostream>
+
#include "base/circlebuf.hh"
-char *strings[] =
-{ "This is the first test\n",
- "he went with his woman to the store\n",
- "the man with the bat hit the woman with the hat\n",
- "that that is is that that was\n",
- "sue sells sea shells by the sea shore\n",
- "go to the store and buy me some milk and bread\n",
- "the friendly flight attendants spoke soothingly to the frightened passengers in their native languages\n"
+const char *strings[] = {
+ "This is the first test\n",
+ "he went with his woman to the store\n",
+ "the man with the bat hit the woman with the hat\n",
+ "that that is is that that was\n",
+ "sue sells sea shells by the sea shore\n",
+ "go to the store and buy me some milk and bread\n",
+ "the friendly flight attendants spoke soothingly to "
+ "the frightened passengers in their native languages\n"
};
const int num_strings = sizeof(strings) / sizeof(char *);
@@ -49,26 +51,26 @@ const int num_strings = sizeof(strings) / sizeof(char *);
int
main()
{
- CircleBuf buf(1024);
+ CircleBuf buf(1024);
- for (int count = 0; count < 100; count++)
- buf.write(strings[count % num_strings]);
- buf.read(STDOUT_FILENO);
- write(STDOUT_FILENO, "<\n", 2);
+ for (int count = 0; count < 100; count++)
+ buf.write(strings[count % num_strings]);
+ buf.read(STDOUT_FILENO);
+ write(STDOUT_FILENO, "<\n", 2);
- for (int count = 0; count < 100; count++)
- buf.write(strings[count % num_strings]);
- buf.read(STDOUT_FILENO, 100);
- write(STDOUT_FILENO, "<\n", 2);
+ for (int count = 0; count < 100; count++)
+ buf.write(strings[count % num_strings]);
+ buf.read(STDOUT_FILENO, 100);
+ write(STDOUT_FILENO, "<\n", 2);
- buf.flush();
- buf.write("asdfa asdf asd fasdf asdf\n");
- buf.write("");
- buf.write("");
- buf.write("");
- buf.write("");
- buf.write("");
- buf.write("");
- buf.read(STDOUT_FILENO);
- write(STDOUT_FILENO, "<\n", 2);
+ buf.flush();
+ buf.write("asdfa asdf asd fasdf asdf\n");
+ buf.write("");
+ buf.write("");
+ buf.write("");
+ buf.write("");
+ buf.write("");
+ buf.write("");
+ buf.read(STDOUT_FILENO);
+ write(STDOUT_FILENO, "<\n", 2);
}
diff --git a/src/unittest/cprintftest.cc b/src/unittest/cprintftest.cc
index 7fb10375c..6722ce6a3 100644
--- a/src/unittest/cprintftest.cc
+++ b/src/unittest/cprintftest.cc
@@ -34,6 +34,7 @@
#include <sstream>
#include "base/cprintf.hh"
+#include "base/misc.hh"
using namespace std;
@@ -43,6 +44,14 @@ main()
char foo[] = "foo";
cprintf("%s\n", foo);
+ string _bar = "asdfkhasdlkfjhasdlkfhjalksdjfhalksdjhfalksdjfhalksdjhf";
+ int length = 11;
+ char bar[length + 1];
+ bar[length] = 0;
+
+ memcpy(bar, _bar.c_str(), length);
+ warn("%s\n", bar);
+
cprintf("%d\n", 'A');
cprintf("%shits%%s + %smisses%%s\n", "test", "test");
cprintf("%%s%-10s %c he went home \'\"%d %#o %#x %1.5f %1.2E\n",
@@ -158,6 +167,13 @@ main()
cprintf("%c %c\n", 'c', 65);
- cout << '9';
+ cout << '9' << endl;
+
+ cout << endl;
+
+ cprintf("%08.4f\n", 99.99);
+ cprintf("%0*.*f\n", 8, 4, 99.99);
+ cprintf("%07.*f\n", 4, 1.234);
+ cprintf("%#0*x\n", 9, 123412);
return 0;
}
diff --git a/src/unittest/foo.ini b/src/unittest/foo.ini
index 534a4e001..0f91c1fd6 100644
--- a/src/unittest/foo.ini
+++ b/src/unittest/foo.ini
@@ -1,4 +1,3 @@
-#define JUNK
[Foo]
Foo1=89
Foo2=384
diff --git a/src/unittest/initest.cc b/src/unittest/initest.cc
index 8f53fce5c..67ac44874 100644
--- a/src/unittest/initest.cc
+++ b/src/unittest/initest.cc
@@ -68,32 +68,14 @@ main(int argc, char *argv[])
progname = argv[0];
- vector<char *> cppArgs;
-
- vector<char *> cpp_options;
- cpp_options.reserve(argc * 2);
-
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 'D':
- case 'U':
- case 'I':
- // cpp options: record & pass to cpp. Note that these
- // cannot have spaces, i.e., '-Dname=val' is OK, but
- // '-D name=val' is not. I don't consider this a
- // problem, since even though gnu cpp accepts the
- // latter, other cpp implementations do not (Tru64,
- // for one).
- cppArgs.push_back(arg_str);
- break;
-
case '-':
// command-line configuration parameter:
// '--<section>:<parameter>=<value>'
@@ -115,7 +97,7 @@ main(int argc, char *argv[])
else {
// no '-', treat as config file name
- if (!simConfigDB.loadCPP(arg_str, cppArgs)) {
+ if (!simConfigDB.load(arg_str)) {
cprintf("Error processing file %s\n", arg_str);
exit(1);
}
diff --git a/src/unittest/initest.ini b/src/unittest/initest.ini
deleted file mode 100644
index ebf2719d8..000000000
--- a/src/unittest/initest.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-#define JUNK
-// General stuff
-#define FOO(X) BAR##X
-[General]
- Test1=FOO(asdf)
- Test2=bar
-
-#ifdef JUNK
-[Junk] // This is the junk
-Test3=yo
-Test4=mama
-#endif
-
-#include "foo.ini"
diff --git a/src/unittest/lru_test.cc b/src/unittest/lru_test.cc
deleted file mode 100644
index d10eb1dd0..000000000
--- a/src/unittest/lru_test.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2003-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Dave Greene
- * Nathan Binkert
- */
-
-#include <iostream>
-#include "bhgp.hh"
-
-int main(void)
-{
- typedef AssociativeTable<unsigned int, unsigned int> tableType;
- tableType table(10, 4); // 40 entry table
-
- std::cout << "Initial state:" << std::endl;
- table.dump();
-
- std::cout << "Inserting (2, 1)" << std::endl;
- table[2] = 1;
- table.dump();
-
- std::cout << "Inserting (5, 2)" << std::endl;
- table[5] = 2;
- table.dump();
-
- std::cout << "Inserting (10 + 2, 3)" << std::endl;
- table[10 + 2] = 3;
- table.dump();
-
- tableType::const_iterator i = table.find(2);
- assert(i != table.end());
- std::cout << "Accessed 2: " << *i << std::endl;
- table.dump();
-
- i = table.find(10 + 2);
- assert(i != table.end());
- std::cout << "Accessed 10 + 2: " << *i << std::endl;
- table.dump();
-
- i = table.find(34);
- assert(i == table.end());
-
- std::cout << "Inserting (2 * 10 + 2, 4)" << std::endl;
- table[2 * 10 + 2] = 4;
- table.dump();
-
- std::cout << "Replacing (10 + 2) with 5" << std::endl;
- table[10 + 2] = 5;
- table.dump();
-
- std::cout << "Inserting (3 * 10 + 2, 6)" << std::endl;
- table[3 * 10 + 2] = 6;
- table.dump();
-
- std::cout << "Inserting (4 * 10 + 2, 7)" << std::endl;
- table[4 * 10 + 2] = 7;
- table.dump();
-
- return(0);
-}
diff --git a/src/unittest/nmtest.cc b/src/unittest/nmtest.cc
index b6b74e08d..fdd865f2d 100644
--- a/src/unittest/nmtest.cc
+++ b/src/unittest/nmtest.cc
@@ -38,9 +38,6 @@
#include "base/str.hh"
using namespace std;
-Tick curTick;
-
-ostream *outputStream = &cout;
int
main(int argc, char *argv[])
diff --git a/src/unittest/offtest.cc b/src/unittest/offtest.cc
deleted file mode 100644
index ebfb2515c..000000000
--- a/src/unittest/offtest.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2002-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Nathan Binkert
- */
-
-#include <sys/types.h>
-#include <stddef.h>
-#include <stdio.h>
-#include "dev/pcireg.h"
-
-int
-main()
-{
-#define POFFSET(x) \
- printf("offsetof(PCIConfig, hdr."#x") = %d\n", \
- offsetof(PCIConfig, hdr.x))
-
- POFFSET(vendor);
- POFFSET(device);
- POFFSET(command);
- POFFSET(status);
- POFFSET(revision);
- POFFSET(progIF);
- POFFSET(subClassCode);
- POFFSET(classCode);
- POFFSET(cacheLineSize);
- POFFSET(latencyTimer);
- POFFSET(headerType);
- POFFSET(bist);
- POFFSET(pci0.baseAddr0);
- POFFSET(pci0.baseAddr1);
- POFFSET(pci0.baseAddr2);
- POFFSET(pci0.baseAddr3);
- POFFSET(pci0.baseAddr4);
- POFFSET(pci0.baseAddr5);
- POFFSET(pci0.cardbusCIS);
- POFFSET(pci0.subsystemVendorID);
- POFFSET(pci0.expansionROM);
- POFFSET(pci0.reserved0);
- POFFSET(pci0.reserved1);
- POFFSET(pci0.interruptLine);
- POFFSET(pci0.interruptPin);
- POFFSET(pci0.minimumGrant);
- POFFSET(pci0.minimumLatency);
-
- return 0;
-}
diff --git a/src/unittest/paramtest.cc b/src/unittest/paramtest.cc
deleted file mode 100644
index e513ab981..000000000
--- a/src/unittest/paramtest.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2002-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Nathan Binkert
- */
-
-//
-// This file is not part of the regular simulator. It is solely for
-// testing the parameter code. Edit the Makefile to add param_test.cc
-// to the sources list, then use configs/test.ini as the configuration
-// file.
-//
-#include "sim/sim_object.hh"
-#include "mem/cache/cache.hh"
-
-class ParamTest : public SimObject
-{
- public:
- ParamTest(string name)
- : SimObject(name)
- {
- }
-
- virtual ~ParamTest() {}
-};
-
-enum Enum1Type { Enum0 };
-enum Enum2Type { Enum10 };
-
-BEGIN_DECLARE_SIM_OBJECT_PARAMS(ParamTest)
-
- Param<int> intparam;
- VectorParam<int> vecint;
- Param<string> stringparam;
- VectorParam<string> vecstring;
- Param<bool> boolparam;
- VectorParam<bool> vecbool;
- SimObjectParam<BaseMemory *> memobj;
- SimObjectVectorParam<BaseMemory *> vecmemobj;
- SimpleEnumParam<Enum1Type> enum1;
- MappedEnumParam<Enum2Type> enum2;
- SimpleEnumVectorParam<Enum1Type> vecenum1;
- MappedEnumVectorParam<Enum2Type> vecenum2;
-
-END_DECLARE_SIM_OBJECT_PARAMS(ParamTest)
-
-const char *enum1_strings[] =
-{
- "zero", "one", "two", "three"
-};
-
-const EnumParamMap enum2_map[] =
-{
- { "ten", 10 },
- { "twenty", 20 },
- { "thirty", 30 },
- { "forty", 40 }
-};
-
-BEGIN_INIT_SIM_OBJECT_PARAMS(ParamTest)
-
- INIT_PARAM(intparam, "intparam"),
- INIT_PARAM(vecint, "vecint"),
- INIT_PARAM(stringparam, "stringparam"),
- INIT_PARAM(vecstring, "vecstring"),
- INIT_PARAM(boolparam, "boolparam"),
- INIT_PARAM(vecbool, "vecbool"),
- INIT_PARAM(memobj, "memobj"),
- INIT_PARAM(vecmemobj, "vecmemobj"),
- INIT_ENUM_PARAM(enum1, "enum1", enum1_strings),
- INIT_ENUM_PARAM(enum2, "enum2", enum2_map),
- INIT_ENUM_PARAM(vecenum1, "vecenum1", enum1_strings),
- INIT_ENUM_PARAM(vecenum2, "vecenum2", enum2_map)
-
-END_INIT_SIM_OBJECT_PARAMS(ParamTest)
-
-
-CREATE_SIM_OBJECT(ParamTest)
-{
- return new ParamTest(getInstanceName());
-}
-
-REGISTER_SIM_OBJECT("ParamTest", ParamTest)
diff --git a/src/unittest/rangemaptest.cc b/src/unittest/rangemaptest.cc
index 983a41520..36223ed9c 100644
--- a/src/unittest/rangemaptest.cc
+++ b/src/unittest/rangemaptest.cc
@@ -35,7 +35,8 @@
using namespace std;
-int main()
+int
+main()
{
range_map<Addr,int> r;
diff --git a/src/unittest/rangemaptest2.cc b/src/unittest/rangemultimaptest.cc
index b253dbe86..a110256c9 100644
--- a/src/unittest/rangemaptest2.cc
+++ b/src/unittest/rangemultimaptest.cc
@@ -28,20 +28,22 @@
* Authors: Ali Saidi
*/
-#include <iostream>
#include <cassert>
+#include <iostream>
+
#include "sim/host.hh"
#include "base/range_map.hh"
using namespace std;
-int main()
+int
+main()
{
- range_multimap<Addr,int> r;
+ typedef range_multimap<Addr, int> multimap_t;
- range_multimap<Addr,int>::iterator i;
- std::pair<range_multimap<Addr,int>::iterator,range_multimap<Addr,int>::iterator>
- jk;
+ multimap_t r;
+ multimap_t::iterator i;
+ std::pair<multimap_t::iterator, multimap_t::iterator> jk;
i = r.insert(RangeIn<Addr>(10,40),5);
assert(i != r.end());
diff --git a/src/unittest/rangetest.cc b/src/unittest/rangetest.cc
index b7a68ab44..eab2f39a8 100644
--- a/src/unittest/rangetest.cc
+++ b/src/unittest/rangetest.cc
@@ -38,39 +38,40 @@ using namespace std;
int
main()
{
- Range<int> r1(make_pair(9, 28));
- Range<unsigned> r2("0x1000:+0x100");
+ Range<int> r1(make_pair(9, 28));
+ Range<unsigned> r2("0x1000:+0x100");
- cout << r1 << "\n"
- << r2 << "\n";
+ cout << r1 << "\n"
+ << r2 << "\n";
-#define RANGETEST(X, C, Y) \
- cout << X << " "#C" " << Y << " => " << ((X C Y) ? "true" : "false") << "\n"
+#define RANGETEST(X, C, Y) \
+ cout << X << " "#C" " << Y << " => " << \
+ ((X C Y) ? "true" : "false") << "\n"
#define TESTEM(X, Y) do { \
- RANGETEST(X, < , Y); \
- RANGETEST(X, <=, Y); \
- RANGETEST(X, > , Y); \
- RANGETEST(X, >=, Y); \
- RANGETEST(X, ==, Y); \
- RANGETEST(X, !=, Y); \
- RANGETEST(Y, < , X); \
- RANGETEST(Y, <=, X); \
- RANGETEST(Y, > , X); \
- RANGETEST(Y, >=, X); \
- RANGETEST(Y, ==, X); \
- RANGETEST(Y, !=, X); \
-} while (0)
+ RANGETEST(X, < , Y); \
+ RANGETEST(X, <=, Y); \
+ RANGETEST(X, > , Y); \
+ RANGETEST(X, >=, Y); \
+ RANGETEST(X, ==, Y); \
+ RANGETEST(X, !=, Y); \
+ RANGETEST(Y, < , X); \
+ RANGETEST(Y, <=, X); \
+ RANGETEST(Y, > , X); \
+ RANGETEST(Y, >=, X); \
+ RANGETEST(Y, ==, X); \
+ RANGETEST(Y, !=, X); \
+ } while (0)
- TESTEM(8, r1);
- TESTEM(9, r1);
- TESTEM(27, r1);
- TESTEM(28, r1);
+ TESTEM(8, r1);
+ TESTEM(9, r1);
+ TESTEM(27, r1);
+ TESTEM(28, r1);
- TESTEM(0x0fff, r2);
- TESTEM(0x1000, r2);
- TESTEM(0x10ff, r2);
- TESTEM(0x1100, r2);
+ TESTEM(0x0fff, r2);
+ TESTEM(0x1000, r2);
+ TESTEM(0x10ff, r2);
+ TESTEM(0x1100, r2);
- return 0;
+ return 0;
}
diff --git a/src/unittest/sized_test.cc b/src/unittest/sized_test.cc
deleted file mode 100644
index f1bf7528f..000000000
--- a/src/unittest/sized_test.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2002-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Dave Greene
- * Nathan Binkert
- */
-
-#include <iostream>
-#include <algorithm>
-
-#include "sized.hh"
-#include <queue>
-#include <typeinfo>
-
-template<typename C>
-void print(C &cont)
-{
- std::cout << std::endl;
- std::cout << "Printing " << typeid(cont).name() << std::endl;
- while (!cont.empty()) {
- std::cout << cont.front() << " ";
- cont.pop();
- }
- std::cout << std::endl;
-}
-
-int main(void)
-{
- sized<std::queue<int>, sized_error_policy<std::queue<int> > >
- error_queue(10);
- sized<std::queue<int>, sized_drop_policy<std::queue<int> > >
- drop_queue(5);
-
- for (int i = 0; i < 10; ++i) {
- error_queue.push(i);
- }
-
- for (int i = 0; i < 3; ++i) {
- drop_queue.push(i);
- }
-
- print(error_queue);
- print(drop_queue);
-
- return(0);
-}
diff --git a/src/unittest/stattest.cc b/src/unittest/stattest.cc
index 4e504fde9..3934786ec 100644
--- a/src/unittest/stattest.cc
+++ b/src/unittest/stattest.cc
@@ -30,9 +30,7 @@
#include <iomanip>
#include <iostream>
-#include <fstream>
#include <string>
-#include <unistd.h>
#include "base/cprintf.hh"
#include "base/misc.hh"
@@ -44,36 +42,6 @@
using namespace std;
using namespace Stats;
-Tick curTick = 0;
-Tick ticksPerSecond = ULL(2000000000);
-
-Scalar<> s1;
-Scalar<> s2;
-Average<> s3;
-Scalar<> s4;
-Vector<> s5;
-Distribution<> s6;
-Vector<> s7;
-AverageVector<> s8;
-StandardDeviation<> s9;
-AverageDeviation<> s10;
-Scalar<> s11;
-Distribution<> s12;
-VectorDistribution<> s13;
-VectorStandardDeviation<> s14;
-VectorAverageDeviation<> s15;
-Vector2d<> s16;
-
-Formula f1;
-Formula f2;
-Formula f3;
-Value f4;
-Value f5;
-Formula f6;
-Formula f7;
-
-ostream *outputStream = &cout;
-
double
testfunc()
{
@@ -85,7 +53,7 @@ class TestClass {
double operator()() { return 9.7; }
};
-char *progname = "";
+const char *progname = "";
void
usage()
@@ -101,14 +69,18 @@ main(int argc, char *argv[])
bool descriptions = false;
bool compat = false;
bool text = false;
+
+#if USE_MYSQL
string mysql_name;
+ string mysql_db;
string mysql_host;
string mysql_user = "binkertn";
string mysql_passwd;
+#endif
char c;
progname = argv[0];
- while ((c = getopt(argc, argv, "cdh:P:p:s:tu:")) != -1) {
+ while ((c = getopt(argc, argv, "cD:dh:P:p:s:tu:")) != -1) {
switch (c) {
case 'c':
compat = true;
@@ -116,6 +88,13 @@ main(int argc, char *argv[])
case 'd':
descriptions = true;
break;
+ case 't':
+ text = true;
+ break;
+#if USE_MYSQL
+ case 'D':
+ mysql_db = optarg;
+ break;
case 'h':
mysql_host = optarg;
break;
@@ -125,12 +104,10 @@ main(int argc, char *argv[])
case 's':
mysql_name = optarg;
break;
- case 't':
- text = true;
- break;
case 'u':
mysql_user = optarg;
break;
+#endif
default:
usage();
}
@@ -139,15 +116,34 @@ main(int argc, char *argv[])
if (!text && (compat || descriptions))
usage();
- s5.init(5);
- s6.init(1, 100, 13);
- s7.init(7);
- s8.init(10);
- s12.init(1, 100, 13);
- s13.init(4, 0, 99, 10);
- s14.init(9);
- s15.init(10);
- s16.init(2, 9);
+ Scalar s1;
+ Scalar s2;
+ Average s3;
+ Scalar s4;
+ Vector s5;
+ Distribution s6;
+ Vector s7;
+ AverageVector s8;
+ StandardDeviation s9;
+ AverageDeviation s10;
+ Scalar s11;
+ Distribution s12;
+ VectorDistribution s13;
+ VectorStandardDeviation s14;
+ VectorAverageDeviation s15;
+ Vector2d s16;
+ Value s17;
+ Value s18;
+
+ Formula f1;
+ Formula f2;
+ Formula f3;
+ Formula f4;
+ Formula f5;
+
+ cprintf("sizeof(Scalar) = %d\n", sizeof(Scalar));
+ cprintf("sizeof(Vector) = %d\n", sizeof(Vector));
+ cprintf("sizeof(Distribution) = %d\n", sizeof(Distribution));
s1
.name("Stat01")
@@ -163,7 +159,7 @@ main(int argc, char *argv[])
s3
.name("Stat03")
.desc("this is statistic 3")
- .prereq(f7)
+ .prereq(f5)
;
s4
@@ -173,6 +169,7 @@ main(int argc, char *argv[])
;
s5
+ .init(5)
.name("Stat05")
.desc("this is statistic 5")
.prereq(s11)
@@ -184,12 +181,14 @@ main(int argc, char *argv[])
;
s6
+ .init(1, 100, 13)
.name("Stat06")
.desc("this is statistic 6")
.prereq(s11)
;
s7
+ .init(7)
.name("Stat07")
.desc("this is statistic 7")
.precision(1)
@@ -198,6 +197,7 @@ main(int argc, char *argv[])
;
s8
+ .init(10)
.name("Stat08")
.desc("this is statistic 8")
.precision(2)
@@ -219,26 +219,31 @@ main(int argc, char *argv[])
;
s12
+ .init(1, 100, 13)
.name("Stat12")
.desc("this is statistic 12")
;
s13
+ .init(4, 0, 99, 10)
.name("Stat13")
.desc("this is statistic 13")
;
s14
+ .init(9)
.name("Stat14")
.desc("this is statistic 14")
;
s15
+ .init(10)
.name("Stat15")
.desc("this is statistic 15")
;
s16
+ .init(2, 9)
.name("Stat16")
.desc("this is statistic 16")
.flags(total)
@@ -248,6 +253,20 @@ main(int argc, char *argv[])
.ysubname(1, "y1")
;
+ s17
+ .functor(testfunc)
+ .name("Stat17")
+ .desc("this is stat 17")
+ ;
+
+ TestClass testclass;
+ s18
+ .functor(testclass)
+ .name("Stat18")
+ .desc("this is stat 18")
+ ;
+
+
f1
.name("Formula1")
.desc("this is formula 1")
@@ -273,29 +292,17 @@ main(int argc, char *argv[])
;
f4
- .functor(testfunc)
.name("Formula4")
.desc("this is formula 4")
;
- TestClass testclass;
- f5
- .functor(testclass)
- .name("Formula5")
- .desc("this is formula 5")
- ;
-
- f6
- .name("Formula6")
- .desc("this is formula 6")
- ;
f1 = s1 + s2;
f2 = (-s1) / (-s2) * (-s3 + ULL(100) + s4);
f3 = sum(s5) * s7;
- f6 += constant(10.0);
- f6 += s5[3];
- f7 = constant(1);
+ f4 += constant(10.0);
+ f4 += s5[3];
+ f5 = constant(1);
check();
reset();
@@ -545,12 +552,14 @@ main(int argc, char *argv[])
out();
}
+#if USE_MYSQL
if (!mysql_name.empty()) {
MySql out;
- out.connect(mysql_host, mysql_user, mysql_passwd, "m5stats",
+ out.connect(mysql_host, mysql_db, mysql_user, mysql_passwd, "test",
mysql_name, "test");
out();
}
+#endif
return 0;
}
diff --git a/src/unittest/strnumtest.cc b/src/unittest/strnumtest.cc
index ea28e35df..0e234884d 100644
--- a/src/unittest/strnumtest.cc
+++ b/src/unittest/strnumtest.cc
@@ -28,8 +28,7 @@
* Authors: Nathan Binkert
*/
-#include <iostream.h>
-
+#include <iostream>
#include <string>
#include <vector>
@@ -40,39 +39,39 @@ using namespace std;
int
main(int argc, char *argv[])
{
- if (argc != 2) {
- cout << "Usage: " << argv[0] << " <number>\n";
- exit(1);
- }
+ if (argc != 2) {
+ cout << "Usage: " << argv[0] << " <number>\n";
+ exit(1);
+ }
- string s = argv[1];
+ string s = argv[1];
#define OUTVAL(valtype, type) do { \
- valtype value; \
- cout << "TYPE = " #valtype "\n"; \
- if (to_number(s, value)) { \
- cout << "Number(" << s << ") = " << dec \
- << (unsigned long long)(unsigned type)value << "\n" \
- << "Number(" << s << ") = " << dec \
- << (signed long long)(signed type)value << "\n" \
- << "Number(" << s << ") = 0x" << hex \
- << (unsigned long long)(unsigned type)value << "\n" \
- << "Number(" << s << ") = 0" << oct \
- << (unsigned long long)(unsigned type)value << "\n\n"; \
- } else \
- cout << "Number(" << s << ") is invalid\n\n"; \
- } while (0)
+ valtype value; \
+ cout << "TYPE = " #valtype "\n"; \
+ if (to_number(s, value)) { \
+ cout << "Number(" << s << ") = " << dec \
+ << (unsigned long long)(unsigned type)value << "\n" \
+ << "Number(" << s << ") = " << dec \
+ << (signed long long)(signed type)value << "\n" \
+ << "Number(" << s << ") = 0x" << hex \
+ << (unsigned long long)(unsigned type)value << "\n" \
+ << "Number(" << s << ") = 0" << oct \
+ << (unsigned long long)(unsigned type)value << "\n\n"; \
+ } else \
+ cout << "Number(" << s << ") is invalid\n\n"; \
+ } while (0)
- OUTVAL(signed long long, long long);
- OUTVAL(unsigned long long, long long);
- OUTVAL(signed long, long);
- OUTVAL(unsigned long, long);
- OUTVAL(signed int, int);
- OUTVAL(unsigned int, int);
- OUTVAL(signed short, short);
- OUTVAL(unsigned short, short);
- OUTVAL(signed char, char);
- OUTVAL(unsigned char, char);
+ OUTVAL(signed long long, long long);
+ OUTVAL(unsigned long long, long long);
+ OUTVAL(signed long, long);
+ OUTVAL(unsigned long, long);
+ OUTVAL(signed int, int);
+ OUTVAL(unsigned int, int);
+ OUTVAL(signed short, short);
+ OUTVAL(unsigned short, short);
+ OUTVAL(signed char, char);
+ OUTVAL(unsigned char, char);
- return 0;
+ return 0;
}
diff --git a/src/unittest/symtest.cc b/src/unittest/symtest.cc
index f0142b923..10ffb42e5 100644
--- a/src/unittest/symtest.cc
+++ b/src/unittest/symtest.cc
@@ -28,12 +28,12 @@
* Authors: Nathan Binkert
*/
-#include <iostream.h>
+#include <iostream>
#include "base/str.hh"
#include "base/loader/symtab.hh"
-Tick curTick = 0;
+using namespace std;
void
usage(const char *progname)
diff --git a/src/unittest/tracetest.cc b/src/unittest/tracetest.cc
deleted file mode 100644
index b1343aac3..000000000
--- a/src/unittest/tracetest.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2003-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Nathan Binkert
- */
-
-#include "sim/host.hh"
-#include "base/trace.hh"
-
-using namespace std;
-
-Tick curTick = 0;
-
-struct foo
-{
- foo()
- {
- char foo[9] = "testing";
- DPRINTF(Loader, "%s\n", foo);
- }
-};
-
-int
-main()
-{
- Trace::flags[Trace::Loader] = true;
- Trace::dprintf_stream = &cout;
-
- foo f;
-
- return 0;
-}