Пример #1
0
        private static void Shutdown()
        {
            // Cleanup of word storage
            TempMemoryScope.EnterScope();
            WordStorage.Shutdown();
            TempMemoryScope.ExitScope();

            DotsRuntime.Shutdown();
        }
Пример #2
0
    public static int Main(string[] args)
    {
        // Not using UnityInstance.Initialize here because it also creates a world, and some tests exist
        // that expect to handle their own world life cycle which currently conflicts with our world design
        UnityInstance.BurstInit();

        DotsRuntime.Initialize();

        TempMemoryScope.EnterScope();
        // Static storage used for the whole lifetime of the process. Create it once here
        // so heap tracking tests won't fight over the storage causing alloc/free mismatches
        WordStorage.Initialize();

        // TypeManager initialization uses temp memory, so let's free it before creating a global scope
        Unity.Entities.TypeManager.Initialize();
        TempMemoryScope.ExitScope();

        // Should have stack trace with tests
        NativeLeakDetection.Mode = NativeLeakDetectionMode.EnabledWithStackTrace;

        int result = 0;

#if UNITY_PORTABLE_TEST_RUNNER
        double start = Time.timeAsDouble;
        UnitTestRunner.Run();
        double end = Time.timeAsDouble;
        PrintResults(end - start);
#else
        result = new AutoRun().Execute(args);
#endif

        TempMemoryScope.EnterScope();
        Unity.Entities.TypeManager.Shutdown();
        WordStorage.Shutdown();
        TempMemoryScope.ExitScope();

        DotsRuntime.Shutdown();

        return(result);
    }