tests: Fix build on x86_gcc2

This patch fixes the build of unittests on x86_gcc2.

src/tests/kits/shared/KeymapTest.cpp:
* Don't use auto
* Don't use braced-initialization for std::map.

src/tests/system/kernel/vm/Jamfile:
* Link lock.o from kernel source to include _mutex_lock and
  _mutex_unlock when linking libkernelvmtest.so

Change-Id: I60e02bfb23334064ec25d767f659a188e393ed1c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2074
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Kyle Ambroff-Kao 2020-01-03 15:29:12 -08:00 committed by Adrien Destugues
parent 230ade3026
commit 4df8f0223b
2 changed files with 18 additions and 14 deletions

View File

@ -70,22 +70,23 @@ KeymapTest::TestGetChars()
CPPUNIT_ASSERT(keymap != NULL);
// Test each of the keymap's character tables
std::map<uint32, int(*)[128]> tables = {
{0, &keymap->normal_map},
{B_SHIFT_KEY, &keymap->shift_map},
{B_CAPS_LOCK, &keymap->caps_map},
{B_CAPS_LOCK | B_SHIFT_KEY, &keymap->caps_shift_map},
{B_CONTROL_KEY, &keymap->control_map},
{B_OPTION_KEY, &keymap->option_map},
{B_OPTION_KEY | B_SHIFT_KEY, &keymap->option_shift_map},
{B_OPTION_KEY | B_CAPS_LOCK, &keymap->option_caps_map},
{B_OPTION_KEY | B_SHIFT_KEY | B_CAPS_LOCK,
&keymap->option_caps_shift_map}
};
typedef std::map<uint32, int32(*)[128]> table_map_t;
table_map_t tables;
tables[0] = &keymap->normal_map;
tables[B_SHIFT_KEY] = &keymap->shift_map;
tables[B_CAPS_LOCK] = &keymap->caps_map;
tables[B_CAPS_LOCK | B_SHIFT_KEY] = &keymap->caps_shift_map;
tables[B_CONTROL_KEY] = &keymap->control_map;
tables[B_OPTION_KEY] = &keymap->option_map;
tables[B_OPTION_KEY | B_SHIFT_KEY] = &keymap->option_shift_map;
tables[B_OPTION_KEY | B_CAPS_LOCK] = &keymap->option_caps_map;
tables[B_OPTION_KEY | B_SHIFT_KEY | B_CAPS_LOCK] =
&keymap->option_caps_shift_map;
for (auto p = tables.begin(); p != tables.end(); p++) {
for (table_map_t::const_iterator p = tables.begin();
p != tables.end(); p++) {
const uint32 modifiers = (*p).first;
const int (*table)[128] = (*p).second;
const int32(*table)[128] = (*p).second;
// Test, for every keycode, that the result from BKeymap::GetChars()
// matches what we find in our our own copy of the keymap

View File

@ -15,6 +15,9 @@ UnitTestLib libkernelvmtest.so
# fs
KPath.cpp
# locks
lock.cpp
: [ TargetLibstdc++ ]
;