86 Commits

Author SHA1 Message Date
PJB3005
788e9386fd Split up test project
Robust.UnitTesting was both ALL tests for RT, and also API surface for content tests.

Tests are now split into separate projects as appropriate, and the API side has also been split off.
2025-12-16 01:36:53 +01:00
PJB3005
38d3b83818 Add display.max_fps CVar.
Applies when vsync is not enabled.

Had to shuffle stuff around to GameController since it involves the game loop.

The implementation isn't great and undershoots the target FPS value (because the OS overshoots the desired sleep value). I tried using SDL_DelayPrecise too but this causes significantly increased CPU usage probably because it spinwaits and all that nonsense, so I decided against it.

I don't know why I bothered to do this. I just got the idea in my head. Kinda feels like a waste of time, but there's no point not committing it at this point.
2025-09-02 22:05:28 +02:00
PJB3005
4bd7aa16c1 Config no longer logs a warning when saved in integration test
Supersedes #6108

See https://github.com/space-wizards/space-station-14/issues/39196
2025-08-02 17:54:09 +02:00
PJB3005
e169d6a5a2 Enforce integration instance idleness for more helper members
Also allow them to be accessed regardless if from the integration instance thread.
2025-07-10 16:29:16 +02:00
PJB3005
3634ee636b Pooled integration instances now get marked non-idle
Otherwise, pooled integration instances could behave differently from freshly-spawned ones, creating heisentests.
2025-07-10 16:26:56 +02:00
Leon Friedrich
c458abdc69 Move TestPair & PoolManager to engine (#5877)
* Engine pool manager

* Move documentation

* Move namespace

* Move TestMapData to engine

* Option to prevent loading test assembly

* release notes

* Rename to avoid conflicts
2025-05-10 21:35:28 +10:00
Leon Friedrich
3ce764311d Make RobustIntegrationTest pool by default (#5872) 2025-04-20 17:53:55 +10:00
Kara
48d70a09c6 Remove most fully-obsoleted code (#5433) 2024-09-11 19:38:26 +10:00
Nyeogmi
6396ec472d XAML hot reloading (#5350)
* Move RobustXaml to a shared package

In a near-future change, I'll make it possible to optionally link to
this from Robust.Client, which will allow JIT compiling XAML.

Also upgrade it to a version of .NET that supports nullability
annotations.

* Re-namespace packages

* Add a JIT compiler, plus hooks that call into it

In Debug, after this change, all XAML will be hot reloaded once every
time an assembly is reloaded.

The new code is compiled with SRE and is _not_ sandboxed -- this is not
suitable to run against prod.

In Release, the hot reload path is totally skipped, using the same trick
as SmugLeaf used in an earlier attempt to implement this functionality.

* Hot reload: watcher

This is a bit of a horror, but there's not in-engine support for
identifying the source tree or the XAML files in it.

* Put everything dangerous behind conditional comp

* Code cleanup, docs

* Fix a bad comment

* Deal a little better with crashes in the watcher

* Make reload failures Info, since they're expected

They were previously causing the integration tests to flag, even though
"a few types fail hot reloading because they're internal" is expected
behavior.

* Fix an unnecessary null check

I removed the ability for CompileCore to return null.

* injectors: null! strings, default primitives

* Tidy documentation (thanks, PJB!)

* Reinstate netstandard2.0, abolish Pidgin

* Internal-ize all of Robust.Xaml

* Add a cautionary note to Sandbox.yml

* Shuffle around where conditional compilation occurs

* Privatize fields in XamlImplementationStorage

* Internalize XamlJitDelegate

* Inline some remarks. No cond. comp in Robust.Xaml

* Use file-scoped namespaces

They aren't allowed at Language Level 8.0. (which I arbitrarily picked
for Robust.Xaml because it's the oldest one that would work)

* Bump language level for R.Xaml, file namespaces

* Force hot reloading off for integration tests

* Fix bizarre comment/behavior in XamlImplementationStorage

* Consistently use interfaces, even in generated code

* Update Robust.Client/ClientIoC.cs

---------

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
2024-08-27 02:16:57 +02:00
Leon Friedrich
75626a86a3 Add dummy sessions for integration tests (#5202)
* Add dummy sessions

* if FULL_RELEASE
2024-06-05 16:50:06 +10:00
Leon Friedrich
83371885fa Support transform states with unknown parents (#4972) 2024-03-17 11:28:50 +11:00
Pieter-Jan Briers
a3047b1687 More warning fixes 2024-02-11 15:51:07 +01:00
Pieter-Jan Briers
af98933173 Isolate net messages in integration tests. (#4838)
* Isolate net messages in integration tests.

Integration tests don't use Lidgren to connect client and send, instead they just use some in-process channels to communicate. Because of this, the original implementation of net messages *directly* passed the net message instances between client and server instances. This caused issues whenever content would mutate data in a NetMessage after it "passed through".

Now we run the messages through WriteToBuffer() and ReadFromBuffer() so they pass through binary serialization. This means there's no more implicit sharing of the objects.

Note that this requires some trickery: Lidgren's message types have internal constructors. Really ideally we'd change the engine to make this more testable... but that's a content breaking change. Instead I just added InternalsVisibleTo to Lidgren so we can mess with it. We maintain the library ourselves anyways I can do what I want.

Fixes #4836

* Register Robust.UnitTesting as assembly for reflection.

This is necessary so that serialized types in the assembly can be picked up by NetSerializer.

Have to disable automatic reflection on all entity systems/components that tests register manually right now, because otherwise tests break.

* Stop shallow cloning specific net messages in integration tests.

This isn't necessary anymore now that we have a thorough fix.

* Wow I really forgot to copy-paste that line to the other side huh.

* Add test that serializer hash matches.

* Another test one I missed earlier.

* Changelog
2024-01-16 21:04:39 +01:00
Leon Friedrich
cfb88b2e8e Arch related engine changes (#4806) 2024-01-04 12:18:03 +11:00
Leon Friedrich
64b5d6e323 Pvs cleanup & expose methods for benchmarking (#4779)
* Pvs cleanup & expose methods for benchmarking

* Fix tests

* Minimalist PvsData
2023-12-30 13:23:29 +11:00
Leon Friedrich
9446ab76f9 Make integration tests fail when logging console errors (#4747)
* Make tests fail when logging console errors

* Add log convenience property
2023-12-23 13:53:23 +11:00
metalgearsloth
24b0165ec9 Revert Arch (#4613) 2023-11-27 21:41:01 +11:00
metalgearsloth
7dce51e2cf Arch PR two electric boogaloo (#4388)
Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
2023-11-23 14:29:37 +11:00
Leon Friedrich
5a6c4220fc IPlayerManager refactor (#4518) 2023-10-24 20:18:58 +11:00
Leon Friedrich
be33bc2219 Re-add force ack threshold (#4423) and fix bugs. (#4438)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2023-10-22 23:27:15 +11:00
Leon Friedrich
06d28f04e6 Add ExecuteCommand() (#4466) 2023-09-30 14:07:07 +10:00
metalgearsloth
3fd731d917 Network entity ids (#4252) 2023-09-11 09:42:55 +10:00
Leon Friedrich
be102f86bf Add IntegrationInstance fields for common dependencies (#4283) 2023-08-21 14:35:27 +10:00
Leon Friedrich
2ff99d4a62 Add support for tests to load extra prototypes from multiple "files" (#4232) 2023-08-04 14:50:08 +10:00
Pieter-Jan Briers
e71f1cc8a5 Warning fixes (#4160)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2023-07-01 22:02:12 +10:00
Leon Friedrich
bb26e243d6 Allow integration tests to raise gui events. (#3937) 2023-04-17 09:52:58 +10:00
Pieter-Jan Briers
de00d2aca2 Integration test logging improvements (#3814) 2023-03-05 22:52:31 +01:00
Pieter-Jan Briers
0d8032e3df Warn on startup if .yaml files detected. (#3764) 2023-02-12 08:12:27 +11:00
Leon Friedrich
5ec72082bb Fix tests (#3605) 2022-12-22 06:26:03 +11:00
Pieter-Jan Briers
be72dd4107 Don't watch for prototype reload in integration tests. 2022-12-19 02:39:28 +01:00
Pieter-Jan Briers
55fd79eb36 Fix GameController exception logging memory leak in tests. 2022-12-10 12:27:23 +01:00
Pieter-Jan Briers
e71cab167b Don't run GC collect in startup in integration tests.
Oof.
2022-12-09 21:22:23 +01:00
Pieter-Jan Briers
1646297039 Remove most static IoCManager. accesses from engine. (#3466)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2022-11-15 22:00:28 +11:00
Pieter-Jan Briers
a416eedff0 Fix some bad doc comment links to IoCManager.Resolve{T}() 2022-11-12 12:23:12 +01:00
Paul Ritter
b8397a1a27 required changes for content benchmarks (#3327) 2022-10-11 20:16:09 +02:00
Leon Friedrich
fe5957bb91 RemoveComponentDeferred changes (#3245) 2022-09-14 15:53:50 +10:00
wrexbe
1b909f71a1 Fix some test issues (#3196) 2022-08-28 14:04:14 -07:00
wrexbe
5848b449f6 Expose way to test sandbox (#3166) 2022-08-25 21:27:42 -07:00
wrexbe
f90872b085 Various test changes (#2930) 2022-06-20 10:03:17 +10:00
Pieter-Jan Briers
05bb361eb2 CEF cookie fixes (#2934)
* Trying to get res:// and usr:// cookies to wrok

* Update CefGlue

* Bump CEF

* Seal types in WebView

Fixes warnings

* Move most of client cleanup to game thread.

This used to run in the windowing thread which broke CEF shutdown, most notably cookie saving.

* "flushcookies" command for CEF.

* Remove unecessary res:// code.

* Fix tests

* More request handler fixes.

* Good thing I don't have to care about commit quality in PRs like this.
2022-06-10 14:30:57 +02:00
Pieter-Jan Briers
de4d255841 Analyzer to enforce classes to be either [Virtual], abstract, or sealed. (#2469)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2022-02-05 19:31:58 +01:00
DrSmugleaf
fa5d0235ec Prepend Client and Server to tests ran message 2021-11-06 11:42:01 +01:00
Javier Guardia Fernández
04d029b9a2 Add test pooling (#2146)
* Add test pooling and global test setup

* WIP test pooling changes

* Make asynchronous tests the default again

* Finish fixing tests, make test threads background threads

* Un-pool tests with custom cvars

* Fix not changing FailureLogLevel cvar on instance return

* Fix error when overriding already overriden cvar

* Don't pool some physics integration tests

* Unpool engine tests, the technology just isn't there yet

* Remove explicit Pool = false from physics tests

* Change default pooling setting to false

* Didn't need this anyway

* Remove ConfigurationManager.ResetOverrides

* Bring back enum cvar override parsing

* Make integrationInstances name clearer > notPooledInstaces
Make clients ready and servers ready internal

* Add logging test instances

* Give more info on ran tests

* Show total clients and servers in test output

* Wipe LayerMap on SpriteComponent.AfterDeserialize

* Fix server not properly kicking clients

* Rider shut

* Make all test metrics report totals

* Format tests ran better

* Replace Console.WriteLine with TestContext.Out.WriteLine

* Fix two server test pooling info prints using total clients instead of total servers

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-11-06 11:18:18 +01:00
Pieter-Jan Briers
0fd210481a Multithread SerializationManager initialize. 2021-09-01 13:38:34 +02:00
Vera Aguilera Puerto
8b013cb424 Fix engine integration tests not generating Net IDs. 2021-07-12 10:42:38 +02:00
Vera Aguilera Puerto
c06707d519 Adds ServerOptions, improve GameControllerOptions, fix engine integration tests (#1844)
* Adds ServerOptions, improve GameControllerOptions, fix engine integration tests

* Do component auto-registration in engine integration tests by default

* Fix integration tests on content, register components ONLY if not contentstarted or options are null

* Add integration test for engine integration tests working correctly

* Move cvar overrides out of content and into engine.
2021-07-03 15:19:46 +02:00
Pieter-Jan Briers
63128324ab Stop RunTicks overriding tick deltas in integration tests.
Now listens to game timing tick rate.
2021-07-03 13:06:19 +02:00
Pieter-Jan Briers
dc8963faa5 Use a no-op mapped string serializer in integration tests.
Serialization never happens in integration tests, so...
2021-06-21 01:29:51 +02:00
Pieter-Jan Briers
f9cf9a8fd4 Single-threaded integration tests experiment.
This didn't really seem to improve performance, so it's not enabled, but I'm not deleting the code.
2021-06-21 00:38:37 +02:00
Pieter-Jan Briers
8efffc471d Multi-window support (#1713) 2021-05-02 14:05:50 +02:00