diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/TestSuite/BotManager.cs | 170 | ||||
-rw-r--r-- | OpenSim/TestSuite/Main.cs | 98 | ||||
-rw-r--r-- | OpenSim/TestSuite/PhysicsBot.cs | 196 | ||||
-rw-r--r-- | OpenSim/TestSuite/README.txt | 25 | ||||
-rw-r--r-- | OpenSim/TestSuite/Util.cs | 81 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 4 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/PhysicsBot.cs | 7 | ||||
-rw-r--r-- | prebuild.xml | 28 |
8 files changed, 9 insertions, 600 deletions
diff --git a/OpenSim/TestSuite/BotManager.cs b/OpenSim/TestSuite/BotManager.cs deleted file mode 100644 index 55ba687..0000000 --- a/OpenSim/TestSuite/BotManager.cs +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Threading; | ||
32 | using OpenMetaverse; | ||
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | ||
37 | |||
38 | namespace OpenSim.TestSuite | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Thread/Bot manager for the application | ||
42 | /// </summary> | ||
43 | public class BotManager | ||
44 | { | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | protected CommandConsole m_console; | ||
48 | protected List<PhysicsBot> m_lBot; | ||
49 | protected Thread[] m_td; | ||
50 | protected bool m_verbose = true; | ||
51 | protected Random somthing = new Random(Environment.TickCount); | ||
52 | protected int numbots = 0; | ||
53 | protected IConfig Previous_config; | ||
54 | |||
55 | /// <summary> | ||
56 | /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data | ||
57 | /// </summary> | ||
58 | public BotManager() | ||
59 | { | ||
60 | m_log.Info("In bot manager"); | ||
61 | m_lBot = new List<PhysicsBot>(); | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// Startup number of bots specified in the starting arguments | ||
66 | /// </summary> | ||
67 | /// <param name="botcount">How many bots to start up</param> | ||
68 | /// <param name="cs">The configuration for the bots to use</param> | ||
69 | public void dobotStartup(int botcount, IConfig cs) | ||
70 | { | ||
71 | Previous_config = cs; | ||
72 | m_td = new Thread[botcount]; | ||
73 | for (int i = 0; i < botcount; i++) | ||
74 | { | ||
75 | startupBot(i, cs); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | /// <summary> | ||
80 | /// Add additional bots (and threads) to our bot pool | ||
81 | /// </summary> | ||
82 | /// <param name="botcount">How Many of them to add</param> | ||
83 | public void addbots(int botcount) | ||
84 | { | ||
85 | int len = m_td.Length; | ||
86 | Thread[] m_td2 = new Thread[len + botcount]; | ||
87 | for (int i = 0; i < len; i++) | ||
88 | { | ||
89 | m_td2[i] = m_td[i]; | ||
90 | } | ||
91 | m_td = m_td2; | ||
92 | int newlen = len + botcount; | ||
93 | for (int i = len; i < newlen; i++) | ||
94 | { | ||
95 | startupBot(i, Previous_config); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// This starts up the bot and stores the thread for the bot in the thread array | ||
101 | /// </summary> | ||
102 | /// <param name="pos">The position in the thread array to stick the bot's thread</param> | ||
103 | /// <param name="cs">Configuration of the bot</param> | ||
104 | public void startupBot(int pos, IConfig cs) | ||
105 | { | ||
106 | PhysicsBot pb = new PhysicsBot(cs); | ||
107 | |||
108 | pb.OnConnected += handlebotEvent; | ||
109 | pb.OnDisconnected += handlebotEvent; | ||
110 | if (cs.GetString("firstname", "random") == "random") pb.firstname = CreateRandomName(); | ||
111 | if (cs.GetString("lastname", "random") == "random") pb.lastname = CreateRandomName(); | ||
112 | |||
113 | m_td[pos] = new Thread(pb.startup); | ||
114 | m_td[pos].Name = "CampBot_" + pos; | ||
115 | m_td[pos].IsBackground = true; | ||
116 | m_td[pos].Start(); | ||
117 | m_lBot.Add(pb); | ||
118 | } | ||
119 | |||
120 | /// <summary> | ||
121 | /// Creates a random name for the bot | ||
122 | /// </summary> | ||
123 | /// <returns></returns> | ||
124 | private string CreateRandomName() | ||
125 | { | ||
126 | string returnstring = ""; | ||
127 | string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; | ||
128 | |||
129 | for (int i = 0; i < 7; i++) | ||
130 | { | ||
131 | returnstring += chars.Substring(somthing.Next(chars.Length),1); | ||
132 | } | ||
133 | return returnstring; | ||
134 | } | ||
135 | |||
136 | /// <summary> | ||
137 | /// High level connnected/disconnected events so we can keep track of our threads by proxy | ||
138 | /// </summary> | ||
139 | /// <param name="callbot"></param> | ||
140 | /// <param name="eventt"></param> | ||
141 | public void handlebotEvent(PhysicsBot callbot, EventType eventt) | ||
142 | { | ||
143 | switch (eventt) | ||
144 | { | ||
145 | case EventType.CONNECTED: | ||
146 | m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected"); | ||
147 | numbots++; | ||
148 | break; | ||
149 | case EventType.DISCONNECTED: | ||
150 | m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected"); | ||
151 | m_td[m_lBot.IndexOf(callbot)].Abort(); | ||
152 | numbots--; | ||
153 | if (numbots > 1) | ||
154 | Environment.Exit(0); | ||
155 | break; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | /// <summary> | ||
160 | /// Shutting down all bots | ||
161 | /// </summary> | ||
162 | public void doBotShutdown() | ||
163 | { | ||
164 | foreach (PhysicsBot pb in m_lBot) | ||
165 | { | ||
166 | pb.shutdown(); | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | } | ||
diff --git a/OpenSim/TestSuite/Main.cs b/OpenSim/TestSuite/Main.cs deleted file mode 100644 index ee75bf5..0000000 --- a/OpenSim/TestSuite/Main.cs +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using Nini.Config; | ||
30 | |||
31 | namespace OpenSim.TestSuite | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Event Types from the BOT. Add new events here | ||
35 | /// </summary> | ||
36 | public enum EventType : int | ||
37 | { | ||
38 | NONE = 0, | ||
39 | CONNECTED = 1, | ||
40 | DISCONNECTED = 2 | ||
41 | } | ||
42 | |||
43 | public class TestSuite | ||
44 | { | ||
45 | public static void Main(string[] args) | ||
46 | { | ||
47 | // TODO: config parser | ||
48 | |||
49 | // TODO: load tests from addings | ||
50 | |||
51 | // TODO: create base bot cloud for use in tests | ||
52 | |||
53 | IConfig config = ParseConfig(args); | ||
54 | if (config.Get("help") != null || config.Get("loginuri") == null) | ||
55 | { | ||
56 | Help(); | ||
57 | } | ||
58 | else | ||
59 | { | ||
60 | // TODO: unused: int botcount = config.GetInt("botcount", 1); | ||
61 | |||
62 | // BotManager bm = new BotManager(); | ||
63 | |||
64 | Utils.TestPass("Completed Startup"); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | private static IConfig ParseConfig(String[] args) | ||
69 | { | ||
70 | //Set up our nifty config.. thanks to nini | ||
71 | ArgvConfigSource cs = new ArgvConfigSource(args); | ||
72 | |||
73 | // TODO: unused: cs.AddSwitch("Startup", "botcount","n"); | ||
74 | cs.AddSwitch("Startup", "loginuri","l"); | ||
75 | cs.AddSwitch("Startup", "firstname"); | ||
76 | cs.AddSwitch("Startup", "lastname"); | ||
77 | cs.AddSwitch("Startup", "password"); | ||
78 | cs.AddSwitch("Startup", "help","h"); | ||
79 | |||
80 | IConfig ol = cs.Configs["Startup"]; | ||
81 | return ol; | ||
82 | } | ||
83 | |||
84 | private static void Help() | ||
85 | { | ||
86 | Console.WriteLine( | ||
87 | "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" + | ||
88 | "Spawns a set of bots to test an OpenSim region\n\n" + | ||
89 | " -l, -loginuri loginuri for sim to log into (required)\n" + | ||
90 | // TODO: unused: " -n, -botcount number of bots to start (default: 1)\n" + | ||
91 | " -firstname first name for the bot(s) (default: random string)\n" + | ||
92 | " -lastname lastname for the bot(s) (default: random string)\n" + | ||
93 | " -password password for the bots(s) (default: random string)\n" + | ||
94 | " -h, -help show this message" | ||
95 | ); | ||
96 | } | ||
97 | } | ||
98 | } | ||
diff --git a/OpenSim/TestSuite/PhysicsBot.cs b/OpenSim/TestSuite/PhysicsBot.cs deleted file mode 100644 index fac4275..0000000 --- a/OpenSim/TestSuite/PhysicsBot.cs +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Threading; | ||
31 | using System.Timers; | ||
32 | using OpenMetaverse; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Console; | ||
36 | using Timer=System.Timers.Timer; | ||
37 | |||
38 | namespace OpenSim.TestSuite | ||
39 | { | ||
40 | public class PhysicsBot | ||
41 | { | ||
42 | public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events | ||
43 | public IConfig startupConfig; // bot config, passed from BotManager | ||
44 | |||
45 | public string firstname; | ||
46 | public string lastname; | ||
47 | public string password; | ||
48 | public string loginURI; | ||
49 | |||
50 | public event AnEvent OnConnected; | ||
51 | public event AnEvent OnDisconnected; | ||
52 | |||
53 | protected Timer m_action; // Action Timer | ||
54 | |||
55 | protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here | ||
56 | |||
57 | //New instance of a SecondLife client | ||
58 | public GridClient client = new GridClient(); | ||
59 | |||
60 | protected string[] talkarray; | ||
61 | /// <summary> | ||
62 | /// | ||
63 | /// </summary> | ||
64 | /// <param name="bsconfig">nini config for the bot</param> | ||
65 | public PhysicsBot(IConfig bsconfig) | ||
66 | { | ||
67 | startupConfig = bsconfig; | ||
68 | readconfig(); | ||
69 | talkarray = readexcuses(); | ||
70 | } | ||
71 | |||
72 | //We do our actions here. This is where one would | ||
73 | //add additional steps and/or things the bot should do | ||
74 | |||
75 | void m_action_Elapsed(object sender, ElapsedEventArgs e) | ||
76 | { | ||
77 | //client.Throttle.Task = 500000f; | ||
78 | //client.Throttle.Set(); | ||
79 | int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number, | ||
80 | // the greater the bot's chances to walk instead of run. | ||
81 | if (walkorrun == 0) | ||
82 | { | ||
83 | client.Self.Movement.AlwaysRun = true; | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | client.Self.Movement.AlwaysRun = false; | ||
88 | } | ||
89 | |||
90 | // TODO: unused: Vector3 pos = client.Self.SimPosition; | ||
91 | Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255)); | ||
92 | client.Self.Movement.TurnToward(newpos); | ||
93 | |||
94 | for (int i = 0; i < 2000; i++) | ||
95 | { | ||
96 | client.Self.Movement.AtPos = true; | ||
97 | Thread.Sleep(somthing.Next(25, 75)); // Makes sure the bots keep walking for this time. | ||
98 | } | ||
99 | client.Self.Jump(true); | ||
100 | |||
101 | string randomf = talkarray[somthing.Next(talkarray.Length)]; | ||
102 | if (talkarray.Length > 1 && randomf.Length > 1) | ||
103 | client.Self.Chat(randomf, 0, ChatType.Normal); | ||
104 | |||
105 | //Thread.Sleep(somthing.Next(1, 10)); // Apparently its better without it right now. | ||
106 | } | ||
107 | |||
108 | /// <summary> | ||
109 | /// Read the Nini config and initialize | ||
110 | /// </summary> | ||
111 | public void readconfig() | ||
112 | { | ||
113 | firstname = startupConfig.GetString("firstname", "random"); | ||
114 | lastname = startupConfig.GetString("lastname", "random"); | ||
115 | password = startupConfig.GetString("password", "12345"); | ||
116 | loginURI = startupConfig.GetString("loginuri"); | ||
117 | } | ||
118 | |||
119 | /// <summary> | ||
120 | /// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes. | ||
121 | /// </summary> | ||
122 | public void shutdown() | ||
123 | { | ||
124 | client.Network.Logout(); | ||
125 | } | ||
126 | |||
127 | /// <summary> | ||
128 | /// This is the bot startup loop. | ||
129 | /// </summary> | ||
130 | public void startup() | ||
131 | { | ||
132 | client.Settings.LOGIN_SERVER = loginURI; | ||
133 | client.Network.LoginProgress += this.Network_LoginProgress; | ||
134 | client.Network.SimConnected += this.Network_SimConnected; | ||
135 | client.Network.Disconnected += this.Network_OnDisconnected; | ||
136 | if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) | ||
137 | { | ||
138 | |||
139 | if (OnConnected != null) | ||
140 | { | ||
141 | m_action = new Timer(somthing.Next(1000, 10000)); | ||
142 | m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed); | ||
143 | m_action.Start(); | ||
144 | OnConnected(this, EventType.CONNECTED); | ||
145 | client.Self.Jump(true); | ||
146 | } | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | MainConsole.Instance.Output(firstname + " " + lastname + "Can't login: " + client.Network.LoginMessage); | ||
151 | if (OnDisconnected != null) | ||
152 | { | ||
153 | OnDisconnected(this, EventType.DISCONNECTED); | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | |||
158 | public void Network_LoginProgress(object sender, LoginProgressEventArgs args) | ||
159 | { | ||
160 | if (args.Status == LoginStatus.Success) | ||
161 | { | ||
162 | if (OnConnected != null) | ||
163 | { | ||
164 | OnConnected(this, EventType.CONNECTED); | ||
165 | } | ||
166 | } | ||
167 | } | ||
168 | |||
169 | public void Network_SimConnected(object sender, SimConnectedEventArgs args) | ||
170 | { | ||
171 | } | ||
172 | |||
173 | public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) | ||
174 | { | ||
175 | if (OnDisconnected != null) | ||
176 | { | ||
177 | OnDisconnected(this, EventType.DISCONNECTED); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | public string[] readexcuses() | ||
182 | { | ||
183 | string allexcuses = ""; | ||
184 | |||
185 | string file = Path.Combine(Util.configDir(), "pCampBotSentences.txt"); | ||
186 | if (File.Exists(file)) | ||
187 | { | ||
188 | StreamReader csr = File.OpenText(file); | ||
189 | allexcuses = csr.ReadToEnd(); | ||
190 | csr.Close(); | ||
191 | } | ||
192 | |||
193 | return allexcuses.Split(Environment.NewLine.ToCharArray()); | ||
194 | } | ||
195 | } | ||
196 | } | ||
diff --git a/OpenSim/TestSuite/README.txt b/OpenSim/TestSuite/README.txt deleted file mode 100644 index cdfa4a7..0000000 --- a/OpenSim/TestSuite/README.txt +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | OpenSim Test Suite | ||
2 | ------------------------------------------------------------ | ||
3 | |||
4 | The eventual goal of the OpenSim Test Suite is to provide a framework | ||
5 | and a set of tests to do system level regression testing of OpenSim. | ||
6 | In short: | ||
7 | |||
8 | OpenSim Test Suite will have Test Modules (Mono Addins?) that will | ||
9 | verify certain paths in the code. Some early modules may be (subject | ||
10 | to change): | ||
11 | |||
12 | * Login Tests | ||
13 | - Attempt to Log in 1, 5, 20 bots. | ||
14 | * Basic Walk Tests | ||
15 | - Attempt to Log in and move about in well known tracks | ||
16 | - Repeat with 5, 20 bots | ||
17 | * Basic Construct Tests | ||
18 | - Construct Simple Objects in World | ||
19 | - Ensure bots can see other objects constructed | ||
20 | * Basic Asset Tests | ||
21 | - Construct Simple Objects in World with Textures | ||
22 | - Pull Objects and Textures | ||
23 | |||
24 | |||
25 | \ No newline at end of file | ||
diff --git a/OpenSim/TestSuite/Util.cs b/OpenSim/TestSuite/Util.cs deleted file mode 100644 index e050c07..0000000 --- a/OpenSim/TestSuite/Util.cs +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.TestSuite | ||
31 | { | ||
32 | public class Utils | ||
33 | { | ||
34 | enum Result | ||
35 | { | ||
36 | Fail = 0, | ||
37 | Pass = 1, | ||
38 | Skip = 3 | ||
39 | } | ||
40 | |||
41 | private static String ResultToString(Result r) | ||
42 | { | ||
43 | if (r == Result.Pass) | ||
44 | { | ||
45 | return "PASS"; | ||
46 | } | ||
47 | else if (r == Result.Fail) | ||
48 | { | ||
49 | return "FAIL"; | ||
50 | } | ||
51 | else if (r == Result.Skip) | ||
52 | { | ||
53 | return "SKIP"; | ||
54 | } | ||
55 | else | ||
56 | { | ||
57 | return "UNKNOWN"; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | private static void TestResult(Result r, String msg) | ||
62 | { | ||
63 | Console.WriteLine("[{0}]: {1}", ResultToString(r), msg); | ||
64 | } | ||
65 | |||
66 | public static void TestFail(String msg) | ||
67 | { | ||
68 | TestResult(Result.Fail, msg); | ||
69 | } | ||
70 | |||
71 | public static void TestPass(String msg) | ||
72 | { | ||
73 | TestResult(Result.Pass, msg); | ||
74 | } | ||
75 | |||
76 | public static void TestSkip(String msg) | ||
77 | { | ||
78 | TestResult(Result.Skip, msg); | ||
79 | } | ||
80 | } | ||
81 | } | ||
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 0aaa226..a4b7f16 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs | |||
@@ -165,18 +165,20 @@ namespace pCampBot | |||
165 | /// </summary> | 165 | /// </summary> |
166 | /// <param name="callbot"></param> | 166 | /// <param name="callbot"></param> |
167 | /// <param name="eventt"></param> | 167 | /// <param name="eventt"></param> |
168 | public void handlebotEvent(PhysicsBot callbot, EventType eventt) | 168 | private void handlebotEvent(PhysicsBot callbot, EventType eventt) |
169 | { | 169 | { |
170 | switch (eventt) | 170 | switch (eventt) |
171 | { | 171 | { |
172 | case EventType.CONNECTED: | 172 | case EventType.CONNECTED: |
173 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); | 173 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); |
174 | numbots++; | 174 | numbots++; |
175 | // m_log.InfoFormat("NUMBOTS {0}", numbots); | ||
175 | break; | 176 | break; |
176 | case EventType.DISCONNECTED: | 177 | case EventType.DISCONNECTED: |
177 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); | 178 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); |
178 | m_td[m_lBot.IndexOf(callbot)].Abort(); | 179 | m_td[m_lBot.IndexOf(callbot)].Abort(); |
179 | numbots--; | 180 | numbots--; |
181 | // m_log.InfoFormat("NUMBOTS {0}", numbots); | ||
180 | if (numbots <= 0) | 182 | if (numbots <= 0) |
181 | Environment.Exit(0); | 183 | Environment.Exit(0); |
182 | break; | 184 | break; |
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs index 0344a82..0c399e3 100644 --- a/OpenSim/Tools/pCampBot/PhysicsBot.cs +++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs | |||
@@ -29,19 +29,23 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | ||
32 | using System.Threading; | 33 | using System.Threading; |
33 | using System.Timers; | 34 | using System.Timers; |
35 | using log4net; | ||
34 | using OpenMetaverse; | 36 | using OpenMetaverse; |
35 | using OpenMetaverse.Assets; | 37 | using OpenMetaverse.Assets; |
36 | using Nini.Config; | 38 | using Nini.Config; |
37 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
39 | using Timer=System.Timers.Timer; | 41 | using Timer = System.Timers.Timer; |
40 | 42 | ||
41 | namespace pCampBot | 43 | namespace pCampBot |
42 | { | 44 | { |
43 | public class PhysicsBot | 45 | public class PhysicsBot |
44 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
45 | public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events | 49 | public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events |
46 | public IConfig startupConfig; // bot config, passed from BotManager | 50 | public IConfig startupConfig; // bot config, passed from BotManager |
47 | 51 | ||
@@ -384,6 +388,7 @@ namespace pCampBot | |||
384 | 388 | ||
385 | public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) | 389 | public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) |
386 | { | 390 | { |
391 | // m_log.ErrorFormat("Fired Network_OnDisconnected"); | ||
387 | if (OnDisconnected != null) | 392 | if (OnDisconnected != null) |
388 | { | 393 | { |
389 | OnDisconnected(this, EventType.DISCONNECTED); | 394 | OnDisconnected(this, EventType.DISCONNECTED); |
diff --git a/prebuild.xml b/prebuild.xml index b9201f7..bf11b0f 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -2549,34 +2549,6 @@ | |||
2549 | </Files> | 2549 | </Files> |
2550 | </Project> | 2550 | </Project> |
2551 | 2551 | ||
2552 | <!-- Test Suite --> | ||
2553 | <Project frameworkVersion="v3_5" name="OpenSim.TestSuite" path="OpenSim/TestSuite" type="Exe"> | ||
2554 | <Configuration name="Debug"> | ||
2555 | <Options> | ||
2556 | <OutputPath>../../bin/</OutputPath> | ||
2557 | </Options> | ||
2558 | </Configuration> | ||
2559 | <Configuration name="Release"> | ||
2560 | <Options> | ||
2561 | <OutputPath>../../bin/</OutputPath> | ||
2562 | </Options> | ||
2563 | </Configuration> | ||
2564 | |||
2565 | <ReferencePath>../../bin/</ReferencePath> | ||
2566 | <Reference name="System"/> | ||
2567 | <Reference name="OpenMetaverseTypes" path="../../bin/"/> | ||
2568 | <Reference name="OpenMetaverse" path="../../bin/"/> | ||
2569 | <Reference name="OpenSim.Framework"/> | ||
2570 | <Reference name="OpenSim.Framework.Console"/> | ||
2571 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | ||
2572 | <Reference name="Nini" path="../../bin/"/> | ||
2573 | <Reference name="log4net" path="../../bin/"/> | ||
2574 | |||
2575 | <Files> | ||
2576 | <Match pattern="*.cs" recurse="true"/> | ||
2577 | </Files> | ||
2578 | </Project> | ||
2579 | |||
2580 | <!-- Test Clients --> | 2552 | <!-- Test Clients --> |
2581 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe"> | 2553 | <Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe"> |
2582 | <Configuration name="Debug"> | 2554 | <Configuration name="Debug"> |