util: Add a unit test for the m5 util's "sum" command.

This change adds the plumbing for and then implements a unit test for
the "sum" command. Despite the fact that this command is very simple,
there are a few things to verify.

1. That args are passed in the right positions.
2. That the number of arguments is checked correctly.
3. That the output to std::cerr is correct.

Change-Id: I71cd473b78fb710cac94df2d70c8d6dc76e5a037
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27566
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2020-04-07 01:18:42 -07:00
parent 8a4fcdee4d
commit ce90cceb25
3 changed files with 146 additions and 0 deletions

View File

@@ -25,6 +25,14 @@
Import('*')
env.Append(CPPPATH=Dir('.'))
env.GTest('args')
env.GTest('call_type')
env.GTest('command', 'command.test.cc', 'command.cc', 'args.cc')
command_tests = env.SConscript('command/SConscript.native', exports='env')
for test in command_tests:
env.GTest('commands/%s' % test, 'command/%s.test.cc' % test,
'command/%s.cc' % test, 'args.cc', 'command.cc')