summaryrefslogtreecommitdiff
path: root/src/unittest
AgeCommit message (Collapse)Author
2017-12-12tests: Turn fbtest into a gtest and move it to src/base.Gabe Black
Change-Id: I9ca57e24f27e0eb747d1f27262972a8abcd10fc8 Reviewed-on: https://gem5-review.googlesource.com/6342 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-12tests: Move the cprintftest unit test into src/base.Gabe Black
That way it will live alongside the code it tests. Change-Id: I00baad2206870a4619b7cee792a1d4c303dad04d Reviewed-on: https://gem5-review.googlesource.com/6324 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-12tests: Convert the cprintf unit test into a gtest.Gabe Black
Change-Id: I0f78a202d1f5fd29cda94ca93b540618831fe898 Reviewed-on: https://gem5-review.googlesource.com/6323 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-12tests: Move the trietest unit test into base.Gabe Black
This puts it alongside trie.hh, the header file it tests. Change-Id: Id8ca0c1d68bdc01807c5ba4b51c0142b1221385d Reviewed-on: https://gem5-review.googlesource.com/6281 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
2017-12-12tests: Plumb dumps of the test trie into the gtest macros.Gabe Black
With this change, when one of the tests fails, it will output a dump of the trie data structure, making it a little easier to tell what happened. Change-Id: I0816ed727ef0b50fefd7ec485356b4fe8790bfe1 Reviewed-on: https://gem5-review.googlesource.com/6267 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
2017-12-12tests: Convert the trie unit test into a gtest.Gabe Black
Change-Id: Idcf60260d9bda1b8ef5b6f5d59b74ca218395f0c Reviewed-on: https://gem5-review.googlesource.com/6265 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
2017-12-06base: Split out the pixel class in framebuffer.(cc|hh).Gabe Black
These are really two separate things. Also, while it's realitively straightforward to write a unit test for the pixel conversion code, the framebuffer object is serializable and brings in more dependencies. Change-Id: If954caeb0bfedb1002cfb1a7a115a00c90d56d19 Reviewed-on: https://gem5-review.googlesource.com/6341 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-06tests: Fix the source file for the cprintftime test.Gabe Black
It was using the source file for the cprintftest unit test. Change-Id: I534798e892ad55cef2f48be2ba9d732aa1993819 Reviewed-on: https://gem5-review.googlesource.com/6321 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-04misc: Rename misc.(hh|cc) to logging.(hh|cc)Gabe Black
These files aren't a collection of miscellaneous stuff, they're the definition of the Logger interface, and a few utility macros for calling into that interface (panic, warn, etc.). Change-Id: I84267ac3f45896a83c0ef027f8f19c5e9a5667d1 Reviewed-on: https://gem5-review.googlesource.com/6226 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-04tests: Remove trietest's dependence on cprintf.Gabe Black
Dumping the structure of the tries being constructed was useful for debugging when the trie data structure was being developed, but the output can't be automatically verified easily, and what's considered correct depends on the specific implementation of the trie itself. To make some of the earlier tests more meaningful, additional lookups were added which verified that the correct values were returned when the nodes of the trie were in particular arrangements. Change-Id: Ib464ad1804d13fe40882da2190d7bf452da83818 Reviewed-on: https://gem5-review.googlesource.com/6223 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-04tests: Add a ptr helper function trietest.Gabe Black
This function casts an integer constant into a uint32_t * to make the actual test lines a bit less verbose. Change-Id: I9307dfd3d5861ddb9c0f6dcf4b28c846004f0a8d Reviewed-on: https://gem5-review.googlesource.com/6222 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-04tests: Get rid of the bitvectest unit test.Gabe Black
This test doesn't really test anything other than the STL vector implementation. Change-Id: I1b932640b1be4fb92a44d314d0b51a94a6a324a2 Reviewed-on: https://gem5-review.googlesource.com/6221 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-11-28tests: Move the bituniontest to be alongside the bitunion header.Gabe Black
Change-Id: I7c1a49c41672a1108fcf67c5505b0441f90588ef Reviewed-on: https://gem5-review.googlesource.com/6142 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-28tests: Reimplement the bituniontest as a googletest.Gabe Black
The implementation is very similar to the old test structurally, and should test all the same things. Change-Id: I58f1559d0943f2494ef06ee1d7ee5314a3852a8c Reviewed-on: https://gem5-review.googlesource.com/6085 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-27tests: Build the input file into the initest unit test.Gabe Black
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>
2017-11-27scons: Switch from "guards" to "tags" on source files.Gabe Black
Tags are just arbitrary strings which are attached to source files which mark them as having some property. By default, all source files have the "gem5 lib" tag added to them which marks them as part of the gem5 library, the primary component of the gem5 binary but also a seperable component for use in, for example, system C. The tags can be completely overridden by setting the "tags" parameter on Source, etc., functions, and can be augmented by setting "add_tags" which are tags that will be added, or alternatively additional tags. It's possible to specify both, in which case the tags will be set to the union of tags and add_tags. add_tags is supposed to be a way to add extra tags to the default without actually overriding the default. Both tags and add_tags can be a list/tuple/etc of tags, or a single string which will be converted into a set internally. Other existing tags include: 1. "python" for files that need or are used with python and are excluded when the --without-python option is set 2. "main" for the file(s) which implement the gem5 binary's main function. 3. The name of a unit test to group its files together. 4. Tags which group source files for partial linking. By grouping the "tags" into a single parameter instead of taking all extra parameters as tags, the extra parameters can, in the future, be passed to the underlying scons environment. Also, the tags are either present or not. With guards, they could be present and True, present and False, or not present at all. Change-Id: I6d0404211a393968df66f7eddfe019897b6573a2 Reviewed-on: https://gem5-review.googlesource.com/5822 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-22tests: Resurrect initest input file(s).Gabe Black
Delete the current version of foo.ini which was modified, restore the previous version, and initest.ini. Preprocess initest.ini which includes foo.ini, and tidy up the resulting file. This file will (mostly) get the initest unit test to work. Some other cleanups are still necessary. Change-Id: I4e46abc73ac89f88177eec92f572452f63ba8019 Reviewed-on: https://gem5-review.googlesource.com/6041 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-11-22tests: Fix the stats unit test.Gabe Black
This has been broken since February. The interface for opening initializing where the stats output should go was changed, but the test wasn't updated. Change-Id: I54bd8be15bf870352d5fcfad95ded28d87c7cc5a Reviewed-on: https://gem5-review.googlesource.com/6001 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-19tests: Fix compilation of cprinftest.Gabe Black
This test has been broken since 70176fecd1ff04 in 2014. The problem was that the array size in the test was technically not constant because it was based on an int variable that wasn't declared as const. That prevented g++ from resolving it as a template parameter. Before the change mentioned above, the implementation wasn't based on templates. Change-Id: I6819cf522f9ba4636ac661da368b9bcbae0a813f Reviewed-on: https://gem5-review.googlesource.com/5821 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2017-05-02python: Use PyBind11 instead of SWIG for Python wrappersAndreas Sandberg
Use the PyBind11 wrapping infrastructure instead of SWIG to generate wrappers for functionality that needs to be exported to Python. This has several benefits: * PyBind11 can be redistributed with gem5, which means that we have full control of the version used. This avoid a large number of hard-to-debug SWIG issues we have seen in the past. * PyBind11 doesn't rely on a custom C++ parser, instead it relies on wrappers being explicitly declared in C++. The leads to slightly more boiler-plate code in manually created wrappers, but doesn't doesn't increase the overall code size. A big benefit is that this avoids strange compilation errors when SWIG doesn't understand modern language features. * Unlike SWIG, there is no risk that the wrapper code incorporates incorrect type casts (this has happened on numerous occasions in the past) since these will result in compile-time errors. As a part of this change, the mechanism to define exported methods has been redesigned slightly. New methods can be exported either by declaring them in the SimObject declaration and decorating them with the cxxMethod decorator or by adding an instance of PyBindMethod/PyBindProperty to the cxx_exports class variable. The decorator has the added benefit of making it possible to add a docstring and naming the method's parameters. The new wrappers have the following known issues: * Global events can't be memory managed correctly. This was the case in SWIG as well. Change-Id: I88c5a95b6cf6c32fa9e1ad31dfc08b2e8199a763 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Hansson <andreas.hansson@arm.com> Reviewed-by: Andrew Bardsley <andrew.bardsley@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2231 Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Pierre-Yves PĂ©neau <pierre-yves.peneau@lirmm.fr> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-02-10misc: Update #!env calls for python to explicit versionJason Lowe-Power
In some newer Linux distributions, env python default to Python 3.0. This patch explicitly uses "python2" instead of just "python" for all scripts that use #! Reported-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
2017-01-27python: Move native wrappers to the _m5 namespaceAndreas Sandberg
Swig wrappers for native objects currently share the _m5.internal name space with Python code. This is undesirable if we ever want to switch from Swig to some other framework for native binding (e.g., PyBind11 or Boost::Python). This changeset moves all of such wrappers to the _m5 namespace, which is now reserved for native code. Change-Id: I2d2bc12dbc05b57b7c5a75f072e08124413d77f3 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2016-11-09style: [patch 1/22] use /r/3648/ to reorganize includesBrandon Potter
2016-02-06style: remove trailing whitespaceSteve Reinhardt
Result of running 'hg m5style --skip-all --fix-white -a'.
2015-08-07base: Rewrite the CircleBuf to fix bugs and add serializationAndreas Sandberg
The CircleBuf class has at least one bug causing it to overwrite the wrong elements when wrapping. The current code has a lot of unused functionality and duplicated code. This changeset replaces the old implementation with a new version that supports serialization and arbitrary types in the buffer (not just char).
2015-05-23base: Redesign internal frame buffer handlingAndreas Sandberg
Currently, frame buffer handling in gem5 is quite ad hoc. In practice, we pass around naked pointers to raw pixel data and expect consumers to convert frame buffers using the (broken) VideoConverter. This changeset completely redesigns the way we handle frame buffers internally. In summary, it fixes several color conversion bugs, adds support for more color formats (e.g., big endian), and makes the code base easier to follow. In the new world, gem5 always represents pixel data using the Pixel struct when pixels need to be passed between different classes (e.g., a display controller and the VNC server). Producers of entire frames (e.g., display controllers) should use the FrameBuffer class to represent a frame. Frame producers are expected to create one instance of the FrameBuffer class in their constructors and register it with its consumers once. Consumers are expected to check the dimensions of the frame buffer when they consume it. Conversion between the external representation and the internal representation is supported for all common "true color" RGB formats of up to 32-bit color depth. The external pixel representation is expected to be between 1 and 4 bytes in either big endian or little endian. Color channels are assumed to be contiguous ranges of bits within each pixel word. The external pixel value is scaled to an 8-bit internal representation using a floating multiplication to map it to the entire 8-bit range.
2015-01-07test: Add a unittest for the BitUnion types.Gabe Black
2014-01-30unittest: Fix build errorsOla Jeppsson
Committed by: Nilay Vaish <nilay@cs.wisc.edu>
2013-09-04arch: Resurrect the NOISA build target and rename it NULLAndreas Hansson
This patch makes it possible to once again build gem5 without any ISA. The main purpose is to enable work around the interconnect and memory system without having to build any CPU models or device models. The regress script is updated to include the NULL ISA target. Currently no regressions make use of it, but all the testers could (and perhaps should) transition to it. --HG-- rename : build_opts/NOISA => build_opts/NULL rename : src/arch/noisa/SConsopts => src/arch/null/SConsopts rename : src/arch/noisa/cpu_dummy.hh => src/arch/null/cpu_dummy.hh rename : src/cpu/intr_control.cc => src/cpu/intr_control_noisa.cc
2012-09-19AddrRange: Transition from Range<T> to AddrRangeAndreas Hansson
This patch takes the final plunge and transitions from the templated Range class to the more specific AddrRange. In doing so it changes the obvious Range<Addr> to AddrRange, and also bumps the range_map to be AddrRangeMap. In addition to the obvious changes, including the removal of redundant includes, this patch also does some house keeping in preparing for the introduction of address interleaving support in the ranges. The Range class is also stripped of all the functionality that is never used. --HG-- rename : src/base/range.hh => src/base/addr_range.hh rename : src/base/range_map.hh => src/base/addr_range_map.hh
2012-09-19AddrRange: Simplify Range by removing stream input/outputAndreas Hansson
This patch simplifies the Range class in preparation for the introduction of a more specific AddrRange class that allows interleaving/striping. The only place where the parsing was used was in the unit test.
2012-09-19AddrRange: Remove unused range_multimapAndreas Hansson
This patch simply removes the unused range_multimap in preparation for a more specific AddrRangeMap that also allows interleaving in addition to pure ranges.
2012-06-05stats: Add stats unittest for total calculations.Ali Saidi
2012-05-10stats: fix compilation of unit test.Ali Saidi
2012-04-14sim: A trie data structure specifically to speed up paging lookups.Gabe Black
This change adds a trie data structure which stores an arbitrary pointer type based on an address and a number of relevant bits. Then lookups can be done against the trie where the tree is traversed and the first legitimate match found is returned.
2011-08-19Stats: Add a sparse histogram stat object.Thomas Grass
2011-06-02copyright: clean up copyright blocksNathan Binkert
2011-04-15unittest: Make unit tests capable of using swig and python, convert stattestNathan Binkert
2011-04-15includes: sort all includesNathan Binkert
2011-01-18Unit tests: Convert the refcnttest unit test to use the new EXPECT macros.Gabe Black
2011-01-18Unit tests: Define a header file for common unit testing functions/macros.Gabe Black
2011-01-10stats: Add a histogram statistic typeNathan Binkert
2011-01-10stats: fix stat test from curTick changeNathan Binkert
2011-01-10RefCount: Add a unit test for reference counting pointers.Gabe Black
This test exercises each of the functions in the reference counting pointer implementation individually (except get()) and verifies they have some minimially expected behavior. It also checks that reference counted objects are freed when their usage count goes to 0 in some basic situations, specifically a pointer being set to NULL and a pointer being deleted.
2011-01-07Replace curTick global variable with accessor functions.Steve Reinhardt
This step makes it easy to replace the accessor functions (which still access a global variable) with ones that access per-thread curTick values.
2010-11-19SCons: Support building without an ISAAli Saidi
2010-07-21stats: cleanup a few small problems in statsNathan Binkert
2009-05-17includes: sort includes againNathan Binkert
2009-05-17types: Move stuff for global types into src/base/types.hhNathan Binkert
--HG-- rename : src/sim/host.hh => src/base/types.hh
2009-03-05stats: Fix all stats usages to deal with template fixesNathan Binkert