MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / TEST_Init

Function TEST_Init

tests/test_common.cpp:110–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void TEST_Init( const SteamNetworkingIdentity *pIdentity )
111{
112 TEST_InitLog( "log.txt" );
113
114 // Test machines are not always realtime systems and may experience thread starvation.
115 // Set very high lock performance warnings so they don't cause test failures.
116 #if __THREAD_SANITIZER__
117 SteamNetworkingSockets_SetLockWaitWarningThreshold( 2000*1000);
118 #else
119 SteamNetworkingSockets_SetLockWaitWarningThreshold( 300*1000 );
120 #endif
121
122 #ifdef STEAMNETWORKINGSOCKETS_OPENSOURCE
123 SteamDatagramErrMsg errMsg;
124 if ( !GameNetworkingSockets_Init( pIdentity, errMsg ) )
125 {
126 fprintf( stderr, "GameNetworkingSockets_Init failed. %s", errMsg );
127 exit(1);
128 }
129 #else
130 //SteamAPI_Init();
131
132 SteamDatagram_SetUniverse();
133 SteamDatagram_SetAppID( 570 ); // Just set something, doesn't matter what
134
135 SteamDatagramErrMsg errMsg;
136 if ( !SteamDatagramClient_Init( errMsg ) )
137 {
138 fprintf( stderr, "SteamDatagramClient_Init failed. %s", errMsg );
139 exit(1);
140 }
141
142 if ( pIdentity )
143 SteamNetworkingSockets()->ResetIdentity( pIdentity );
144
145 // Disable auth
146 SteamNetworkingUtils()->SetGlobalConfigValueInt32( k_ESteamNetworkingConfig_IP_AllowWithoutAuth, 2 );
147
148 #endif
149}
150
151void TEST_Kill()
152{

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 7

TEST_InitLogFunction · 0.85
SteamNetworkingSocketsFunction · 0.85
SteamNetworkingUtilsFunction · 0.85
ResetIdentityMethod · 0.80

Tested by

no test coverage detected