|
OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
|
Classes | |
| class | FakeMaster |
Functions | |
| log_lines (path, timed=False) | |
| query (port, command, timeout=2.0) | |
| players (port) | |
| rcon (port, password, command) | |
| wait_for (condition, seconds=5.0) | |
| check_client (port, protocol, plus, password, game_log, check) | |
| check_master (args, check) | |
| check_console_log (path, check) | |
| check_vote_limit (port, protocol, password, check) | |
| check_client_noise (port, protocol, password, console_log, check) | |
| check_signed_challenge (port, protocol, password, check) | |
| check_stateless_challenge (port, protocol, password, check) | |
| check_query_limits (port, check) | |
| check_challenge_during_queries (port, check) | |
| check_alt_client (alt_port, password, port, check) | |
| check_connect_limit (port, protocol, plus, check) | |
| check_game_log_rotation (path, check) | |
| check_strict_port (args, port, check) | |
| free_port () | |
| main () | |
Variables | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| str | PREFIX = b'\xff\xff\xff\xff' |
| str | SMOKE_GAMETYPE |
Starts the Linux server against a real game folder and checks that it answers.
python3 scripts/smoke_test.py /path/to/CoD2 [--protocol 118] [--plus] [--binary bin/cod2rev_lnxded]
--plus checks a `make PLUS=1` build: stock and other Plus clients are told to
update, and a Plus client gets Plus snapshots.
Besides the queries, a minimal client (cod2client.py) connects, receives the
gamestate, enters the game and sends commands, one of them in a fragmented
message. The game folder is only read: logs and configs go to a temporary home
folder. The server runs in LAN mode (dedicated 1), so nothing is sent to the
master servers; a second run in internet mode (dedicated 2) heartbeats to a fake
master on 127.0.0.1 instead of the real ones. Exits with 0 when every check
passes.
| smoke_test.check_alt_client | ( | alt_port, | |
| password, | |||
| port, | |||
| check ) |
A 1.3 client joins through net_altPort. Its socket only hears that port, so a reply from net_port would not reach it.
| smoke_test.check_challenge_during_queries | ( | port, | |
| check ) |
A burst of queries, which share a low global limit, must not stop a player joining.
| smoke_test.check_client | ( | port, | |
| protocol, | |||
| plus, | |||
| password, | |||
| game_log, | |||
| check ) |
Connects a minimal client that receives the gamestate, enters the game and sends commands, including one message split into fragments, so the netchan, the XOR keys, Huffman decompression, SV_ClientCommand and SV_UserMove are all used as a player uses them.
| smoke_test.check_client_noise | ( | port, | |
| protocol, | |||
| password, | |||
| console_log, | |||
| check ) |
A client cannot flood the menu commands, which skip flood protection, nor the log with malformed packets. developer 1 puts the debug prints of the commands ignored in the console log.
| smoke_test.check_connect_limit | ( | port, | |
| protocol, | |||
| plus, | |||
| check ) |
A local proxy's players, all from 127.0.0.1, get in together; a flood from another address is cut.
| smoke_test.check_console_log | ( | path, | |
| check ) |
logfileName, logfileRotate and logTimestamps: the previous log is kept as .1, and every line of the new one starts with the date and time.
| smoke_test.check_game_log_rotation | ( | path, | |
| check ) |
g_logRotateSize: the oversized games_mp.log was kept as .1 and a new one started.
| smoke_test.check_master | ( | args, | |
| check ) |
Internet mode (dedicated 2) against a fake master on 127.0.0.1: the heartbeats, the status sent on its own, the replies to the master's queries and the flatline when SIGTERM makes it quit, and a console log that can't be opened (warned about once, nothing rotated). The real masters and the authorize server are left empty or pointed at an unused local port, so nothing leaves the machine.
| smoke_test.check_query_limits | ( | port, | |
| check ) |
getinfo and getstatus have global limits of their own: a burst of getstatus must not silence getinfo, which browsers use, and getinfo has room for 100 a second. 127.0.0.1 has no per-address limit.
| smoke_test.check_signed_challenge | ( | port, | |
| protocol, | |||
| password, | |||
| check ) |
A challenge is signed for its address, so a client whose challenge a flood of other addresses pushed out of the 1024-slot table still joins. With net_lanauthorize 1 and a fake authorize server, that client also has to wait for the authorize reply, which a connect asks for again.
| smoke_test.check_stateless_challenge | ( | port, | |
| protocol, | |||
| password, | |||
| check ) |
With sv_challengeStateless 1 getchallenge answers at once with the signed challenge, takes no slot and has no global limit, so a burst from other addresses doesn't keep a player out; the connect asks the authorize server.
| smoke_test.check_strict_port | ( | args, | |
| port, | |||
| check ) |
net_strictPort 1: a second server on the busy port stops instead of moving to the next one.
| smoke_test.check_vote_limit | ( | port, | |
| protocol, | |||
| password, | |||
| check ) |
A player calls at most three votes a map. Each vote kicks a client of its own, so they pass at once and the voter stays.
| smoke_test.free_port | ( | ) |
| smoke_test.log_lines | ( | path, | |
| timed = False ) |
A log's lines, without the time each one starts with, as in " 1:23 K;...".
| smoke_test.main | ( | ) |
| smoke_test.players | ( | port | ) |
{name: ping} of the clients listed by getstatus, or None without a reply.
| smoke_test.query | ( | port, | |
| command, | |||
| timeout = 2.0 ) |
Sends a connectionless command and returns the reply as (header, info dict), or None.
| smoke_test.rcon | ( | port, | |
| password, | |||
| command ) |
| smoke_test.wait_for | ( | condition, | |
| seconds = 5.0 ) |
| str smoke_test.PREFIX = b'\xff\xff\xff\xff' |
| smoke_test.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| str smoke_test.SMOKE_GAMETYPE |