public bool Run() { bool success = true; int count = 0; int successcnt = 0; var decoder = new UDPPacketDecoder(true); foreach (KeyValuePair <string, byte[]> data in DataBlocks) { ++count; var tr = new TestRunner.TestResult() { Name = "UDP Packet " + data.Key, Result = false, Message = string.Empty }; int startTime = Environment.TickCount; m_Log.InfoFormat("Testing decoding of {0}", data.Key); try { var p = new UDPPacket(); Buffer.BlockCopy(data.Value, 0, p.Data, 0, data.Value.Length); p.DataLength = data.Value.Length; if (p.HasAckFlag) { List <uint> acks = p.Acks; m_Log.InfoFormat("Packet has {0} ack numbers", acks.Count); } MessageType mType = p.ReadMessageType(); Func <UDPPacket, Message> m = decoder.PacketTypes[mType]; Message res = m(p); m_Log.InfoFormat("Decoding of {0} successful: got {1}", data.Key, res.GetType().FullName); ++successcnt; tr.Result = true; } catch (Exception e) { m_Log.ErrorFormat("Decoding of {0} failed: {1}", data.Key, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } tr.RunTime = Environment.TickCount - startTime; m_Runner.TestResults.Add(tr); } m_Log.InfoFormat("{0} of {1} decodings successful", successcnt, count); return(success); }
public bool Run() { bool success = true; int count = 0; int successcnt = 0; foreach (KeyValuePair <UUID, string> file in Files) { ++count; var tr = new TestRunner.TestResult { Name = "Script " + file.Key + "(" + file.Value + ")", Result = false, Message = string.Empty }; int startTime = Environment.TickCount; m_Log.InfoFormat("Testing compilation of {1} ({0})", file.Key, file.Value); try { using (TextReader reader = new StreamReader(file.Value, new UTF8Encoding(false))) { CompilerRegistry.ScriptCompilers.Compile(AppDomain.CurrentDomain, UGUI.Unknown, file.Key, reader, includeOpen: (name) => OpenFile(name, file.Value)); } m_Log.InfoFormat("Compilation of {1} ({0}) successful", file.Key, file.Value); ++successcnt; tr.Result = true; } catch (CompilerException e) { m_Log.ErrorFormat("Compilation of {1} ({0}) failed: {2}", file.Key, file.Value, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } catch (Exception e) { m_Log.ErrorFormat("Compilation of {1} ({0}) failed: {2}", file.Key, file.Value, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } tr.RunTime = Environment.TickCount - startTime; m_Runner.TestResults.Add(tr); } m_Log.InfoFormat("{0} of {1} compilations successful", successcnt, count); return(success); }
public bool Run() { bool success = true; int count = 0; int successcnt = 0; foreach (KeyValuePair <UUID, string> file in Assets) { ++count; var tr = new TestRunner.TestResult { Name = "Asset " + file.Key + "(" + file.Value + ")", Result = false, Message = string.Empty }; int startTime = Environment.TickCount; m_Log.InfoFormat("Testing deserialization of {1} ({0})", file.Key, file.Value); try { using (Stream s = new HttpClient.Get(file.Value).ExecuteStreamRequest()) { ObjectXML.FromXml(s, UGUI.Unknown, XmlDeserializationOptions.ReadKeyframeMotion); } m_Log.InfoFormat("Deserialization of {1} ({0}) successful", file.Key, file.Value); ++successcnt; tr.Result = true; } catch (Exception e) { m_Log.ErrorFormat("Compilation of {1} ({0}) failed: {2}", file.Key, file.Value, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } tr.RunTime = Environment.TickCount - startTime; m_Runner.TestResults.Add(tr); } m_Log.InfoFormat("{0} of {1} compilations successful", successcnt, count); return(success); }
public bool Run() { bool success = true; int count = 0; int successcnt = 0; foreach (string filename in Filenames) { ++count; var tr = new TestRunner.TestResult() { Name = "LLSD Binary Data " + filename, Result = false, Message = string.Empty }; int startTime = Environment.TickCount; m_Log.InfoFormat("Testing decoding of {0}", filename); try { using (var stream = new FileStream(filename, FileMode.Open)) { LlsdBinary.Deserialize(stream); } m_Log.InfoFormat("Decoding of {0} successful", filename); ++successcnt; tr.Result = true; } catch (Exception e) { m_Log.ErrorFormat("Decoding of {0} failed: {1}", filename, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } tr.RunTime = Environment.TickCount - startTime; m_Runner.TestResults.Add(tr); } m_Log.InfoFormat("{0} of {1} decodings successful", successcnt, count); return(success); }
public bool Run() { bool success = true; int count = 0; int successcnt = 0; foreach (string file in Archives) { using (var fs = new FileStream(file, FileMode.Open)) { using (var gz = new GZipStream(fs, CompressionMode.Decompress)) { using (var tarreader = new TarArchiveReader(gz)) { for (; ;) { TarArchiveReader.Header h; try { h = tarreader.ReadHeader(); } catch (TarArchiveReader.EndOfTarException) { break; } if (h.FileType != TarFileType.File || !h.FileName.StartsWith("assets/") || !h.FileName.EndsWith(".lsl")) { continue; } byte[] scriptdata; using (var ms = new MemoryStream()) { tarreader.CopyTo(ms); scriptdata = ms.ToArray(); } ++count; UUID id = UUID.Parse(h.FileName.Substring(7, 36)); var tr = new TestRunner.TestResult { Name = "Script " + id + "(" + file + ")", Result = false, Message = string.Empty }; int startTime = Environment.TickCount; m_Log.InfoFormat("Testing compilation of {0} ({1})", id, file); try { using (TextReader reader = new StreamReader(new MemoryStream(scriptdata), new UTF8Encoding(false))) { CompilerRegistry.ScriptCompilers.Compile(AppDomain.CurrentDomain, UGUI.Unknown, id, reader, includeOpen: (name) => OpenFile(name)); } m_Log.InfoFormat("Compilation of {0} ({1}) successful", id, file); ++successcnt; tr.Result = true; } catch (CompilerException e) { m_Log.ErrorFormat("Compilation of {0} ({1}) failed: {2}", id, file, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } catch (Exception e) { m_Log.ErrorFormat("Compilation of {0} ({1}) failed: {2}", id, file, e.Message); m_Log.WarnFormat("Stack Trace:\n{0}", e.StackTrace); tr.Message = e.Message + "\n" + e.StackTrace; success = false; } if (!tr.Result && Directory.Exists("../data/dumps/scripts")) { using (var dumpfs = new FileStream("../data/dumps/scripts/" + id + "_script.lsl", FileMode.Create)) { dumpfs.Write(scriptdata, 0, scriptdata.Length); } } tr.RunTime = Environment.TickCount - startTime; m_Runner.TestResults.Add(tr); } } } } } m_Log.InfoFormat("{0} of {1} compilations successful", successcnt, count); return(success); }