Skip to content

Commit 4f063c4

Browse files
committed
unittests: fix library loading
1 parent dcdcf6b commit 4f063c4

File tree

9 files changed

+156
-127
lines changed

9 files changed

+156
-127
lines changed

gameui/BasePanel.cpp

+18-2
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ CBasePanel::CBasePanel() : Panel(NULL, "BaseGameUIPanel")
915915
}
916916
}
917917

918-
if( IsAndroid() )
918+
// if( IsAndroid() )
919919
{
920920
AddUrlButton( this, "vgui/\x64\x69\x73\x63\x6f\x72\x64\x5f\x6c\x6f\x67\x6f", "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x64\x69\x73\x63\x6f\x72\x64\x2e\x67\x67\x2f\x68\x5a\x52\x42\x37\x57\x4d\x67\x47\x77" );
921921
AddUrlButton( this, "vgui/\x74\x77\x69\x74\x74\x65\x72\x5f\x6c\x6f\x67\x6f", "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x77\x69\x74\x74\x65\x72\x2e\x63\x6f\x6d\x2f\x6e\x69\x6c\x6c\x65\x72\x75\x73\x72" );
@@ -1607,14 +1607,30 @@ CGameMenu *CBasePanel::RecursiveLoadGameMenu(KeyValues *datafile)
16071607
else
16081608
menu->AddMenuItem("Console", "CONSOLE", "OpenConsole", this);
16091609

1610+
bool bFoundServerBrowser = false;
1611+
1612+
for (KeyValues *dat = datafile->GetFirstSubKey(); dat != NULL; dat = dat->GetNextKey())
1613+
{
1614+
const char *label = dat->GetString("label", "<unknown>");
1615+
const char *cmd = dat->GetString("command", NULL);
1616+
const char *name = dat->GetString("name", label);
1617+
1618+
if( cmd && Q_strcmp(cmd, "OpenServerBrowser") == 0 )
1619+
bFoundServerBrowser = true;
1620+
}
1621+
1622+
if( !bFoundServerBrowser && !ModInfo().IsSinglePlayerOnly() )
1623+
menu->AddMenuItem("AntiM*dG*yButton", "#GameUI_GameMenu_FindServers", "OpenServerBrowser", this);
1624+
16101625
// loop through all the data adding items to the menu
16111626
for (KeyValues *dat = datafile->GetFirstSubKey(); dat != NULL; dat = dat->GetNextKey())
16121627
{
16131628
const char *label = dat->GetString("label", "<unknown>");
16141629
const char *cmd = dat->GetString("command", NULL);
16151630
const char *name = dat->GetString("name", label);
16161631

1617-
if ( cmd && !Q_stricmp( cmd, "OpenFriendsDialog" ) && bSteamCommunityFriendsVersion )
1632+
if ( cmd && (!Q_stricmp( cmd, "OpenFriendsDialog" )
1633+
|| !Q_stricmp( cmd, "engine bug" )) )
16181634
continue;
16191635

16201636
menu->AddMenuItem(name, label, cmd, this, dat);

public/dispcoll_common.cpp

+1-9
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,7 @@ void CDispCollTree::AABBTree_CreateLeafs( void )
429429
}
430430
}
431431

432-
#if COMPILER_CLANG
433-
#define NOASAN __attribute__((no_sanitize("address")))
434-
#else
435-
#define NOASAN
436-
#endif
437-
438-
void NOASAN CDispCollTree::AABBTree_GenerateBoxes_r( int nodeIndex, Vector *pMins, Vector *pMaxs )
432+
void NO_ASAN CDispCollTree::AABBTree_GenerateBoxes_r( int nodeIndex, Vector *pMins, Vector *pMaxs )
439433
{
440434
// leaf
441435
ClearBounds( *pMins, *pMaxs );
@@ -467,8 +461,6 @@ void NOASAN CDispCollTree::AABBTree_GenerateBoxes_r( int nodeIndex, Vector *pMin
467461
}
468462
}
469463

470-
#undef NOASAN
471-
472464
//-----------------------------------------------------------------------------
473465
// Purpose:
474466
//-----------------------------------------------------------------------------

public/tier0/platform.h

+6
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,12 @@ typedef void * HINSTANCE;
606606
#define FMTFUNCTION( a, b )
607607
#endif
608608

609+
#if COMPILER_CLANG || COMPILER_GCC
610+
#define NO_ASAN __attribute__((no_sanitize("address")))
611+
#else
612+
#define NO_ASAN
613+
#endif
614+
609615
#if defined( _WIN32 )
610616

611617
// Used for dll exporting and importing

public/tier0/tslist.h

+8-7
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,21 @@ union TSLIST_HEAD_ALIGN TSLHead_t
123123
// but it could perhaps (?) lead to problems with store forwarding. I don't know 'cause I didn't
124124
// performance-test or design original code, I'm just making it work on PowerPC.
125125
#ifdef VALVE_BIG_ENDIAN
126-
int16 Sequence;
127-
int16 Depth;
126+
uint16 Sequence;
127+
uint16 Depth;
128128
#else
129-
int16 Depth;
130-
int16 Sequence;
129+
uint16 Depth;
130+
uint16 Sequence;
131131
#endif
132132
#ifdef PLATFORM_64BITS
133-
int32 Padding;
133+
uint32 Padding;
134134
#endif
135135
} value;
136136

137137
struct Value32_t
138138
{
139139
TSLNodeBase_t *Next_do_not_use_me;
140-
int32 DepthAndSequence;
140+
uint32 DepthAndSequence;
141141
} value32;
142142

143143
#ifdef PLATFORM_64BITS
@@ -254,7 +254,8 @@ class CTSListBase
254254
#endif
255255
}
256256

257-
TSLNodeBase_t *Pop()
257+
// TODO(nillerusr): fix asan issue later
258+
NO_ASAN TSLNodeBase_t *Pop()
258259
{
259260
#ifdef USE_NATIVE_SLIST
260261
#ifdef _X360

scripts/tests-ubuntu-amd64.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ git submodule init && git submodule update
44
sudo apt-get update
55
sudo apt-get install -f -y gdb libopenal-dev g++-multilib gcc-multilib libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev libedit-dev
66

7-
./waf configure -T release --disable-warns --tests --prefix=out/ --64bits $* &&
7+
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ --64bits $* &&
88
./waf install &&
99
cd out &&
1010
LD_LIBRARY_PATH=bin/ ./unittest

scripts/tests-ubuntu-i386.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sudo apt-get update
66
sudo apt-get install -y aptitude
77
sudo aptitude install -y libopenal-dev:i386 g++-multilib gcc-multilib libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 libfontconfig1-dev:i386 libcurl4-gnutls-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386 libbz2-dev:i386 libedit-dev:i386
88

9-
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --disable-warns --tests --prefix=out/ $* &&
9+
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
1010
./waf install &&
1111
cd out &&
1212
LD_LIBRARY_PATH=bin/ ./unittest

tier1/interface.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ bool foundLibraryWithPrefix( char *pModuleAbsolutePath, size_t AbsolutePathSize,
292292
bFound |= stat(pModuleAbsolutePath, &statBuf) == 0;
293293
}
294294

295+
if( !bFound )
296+
{
297+
Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/lib%s", pPath, str);
298+
bFound |= stat(pModuleAbsolutePath, &statBuf) == 0;
299+
}
300+
301+
if( !bFound )
302+
{
303+
Q_snprintf(pModuleAbsolutePath, AbsolutePathSize, "%s/%s", pPath, str);
304+
bFound |= stat(pModuleAbsolutePath, &statBuf) == 0;
305+
}
306+
295307
return bFound;
296308
}
297309

unittests/tier1test/wscript

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def configure(conf):
1414
conf.define('TIER1TEST_EXPORTS', 1)
1515

1616
def build(bld):
17-
source = ['commandbuffertest.cpp', 'utlstringtest.cpp', 'tier1test.cpp']
17+
source = ['commandbuffertest.cpp', 'utlstringtest.cpp', 'tier1test.cpp'] #, 'lzsstest.cpp']
1818
includes = ['../../public', '../../public/tier0']
1919
defines = []
2020
libs = ['tier0', 'tier1', 'mathlib', 'unitlib']

0 commit comments

Comments
 (0)