Esempio n. 1
0
        private void PushTimeout(object state)
        {
            var testPath = new StringBuilder();
            {
                var testLoopCount = m_TestPathLengthRandom.Next(1, 8);
                for (int i = 0; i < testLoopCount; i++)
                {
                    testPath.Append(Guid.NewGuid().ToString("N"));
                }
            }

            var item = new QueueItem
            {
                ItemTime = DateTimeOffset.Now,
                Path     = testPath.ToString()
            };

            var str = JsonConvert.SerializeObject(item);

            m_Target.PushRecord(str);


            m_PushRecentCount++;
            _trace.Trace($"Pushed, Count={m_PushRecentCount}");

            if (PushMaxCount == m_PushRecentCount)
            {
                _trace.Trace("Push End");

                m_PushTimerIsContinue = false;
                m_PopTimer.Change(-1, -1);

                Task.Run(() =>
                {
                    _trace.Trace("Complete Thread Start");
                    TestPushAllTime.Stop();
                    m_PushTimer = null;
                    m_PopTimer.Dispose();
                    m_PopTimer = null;
                    PopTimeout(null);
                    TestPopAllTime.Stop();
                    m_CheckTimer_FileSize.Dispose();
                    m_CheckTimer_FileSize = null;
                    m_CheckTimer_MemorySize.Dispose();
                    m_CheckTimer_MemorySize = null;

                    _trace.Warn($"{nameof(TestPushAllTime)}={TestPushAllTime.Elapsed}");
                    _trace.Warn($"{nameof(TestPopAllTime)}={TestPopAllTime.Elapsed}");
                    _trace.Warn($"{nameof(MaxFileSize)}={MaxFileSize}");
                    _trace.Warn($"{nameof(MaxMemorySize)}={MaxMemorySize}");

                    OnTestEnd?.Invoke();
                });
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Raise end of test
        /// </summary>
        /// <param name="result">Result</param>
        void RaiseOnTestEnd(EFuzzingReturn result, FuzzerStat <IFuzzingInput>[] sinput, FuzzerStat <IFuzzingConfig>[] sconfig)
        {
            if (sinput != null)
            {
                foreach (FuzzerStat <IFuzzingInput> i in sinput)
                {
                    i.Increment(result);
                }
            }
            if (sconfig != null)
            {
                foreach (FuzzerStat <IFuzzingConfig> i in sconfig)
                {
                    i.Increment(result);
                }
            }

            OnTestEnd?.Invoke(this, result, sinput, sconfig);
        }