Example #1
0
            private void AddTest(ref BaseTest[] list, ref int index, string slnPath)
            {
                if (m_isProfilerRun)
                {
                    list[index] = new ProfilerTest();
                }
                else
                {
                    list[index] = new MicroFrameworkTest();
                }

                list[index].Name = slnPath;
                list[index++].Location = slnPath;
            }
Example #2
0
            private BaseTest[] BuildSolutionFileList(string dirProjPath)
            {
                // Scan build.dirproj to generate the test list.                                               
                //List<string> staticList = new List<string>();
                ArrayList test_list = new ArrayList();
                if (m_isStaticList)
                {
                    foreach (string file in File.ReadAllLines(m_staticList))
                    {
                        //staticList.Add(file.ToLower());
                        test_list.Add(file.ToLower());
                    }
                }
                else
                {
                    test_list = BuildTestList(dirProjPath, new ArrayList());

                    // Add the DPWS fixture tests which are built by the build system to the test list.
                    string dpwsFixtureTestPath = "";

                    string flav = Environment.GetEnvironmentVariable("FLAVOR");
                    
                    if (string.IsNullOrEmpty(flav))
                    {
                        flav = "Release";
                    }

                    dpwsFixtureTestPath = string.Format(@"{0}\BuildOutput\public\{1}\test\server\dpws",
                        Environment.GetEnvironmentVariable("SPOCLIENT"),
                        flav);

                    if (!Directory.Exists(dpwsFixtureTestPath))
                    {
                        if (flav.ToLower() == "debug") flav = "Release";
                        else flav = "Debug";

                        dpwsFixtureTestPath = string.Format(@"{0}\BuildOutput\public\{1}\test\server\dpws",
                            Environment.GetEnvironmentVariable("SPOCLIENT"),
                            flav);
                    }

                    if (Directory.Exists(dpwsFixtureTestPath))
                    {
                        FileInfo[] dpwsSlnFiles = new DirectoryInfo(dpwsFixtureTestPath).GetFiles("*.sln");
                        foreach (FileInfo dpwsSlnFile in dpwsSlnFiles)
                        {
                            test_list.Add(dpwsSlnFile.FullName);
                        }
                    }
                }

                // Copy the contents of the local arraylist to the string array.
                BaseTest[] list = new BaseTest[test_list.Count * m_runCount];
                for (int rc = 0; rc < m_runCount; rc++)
                {
                    for (int i = 0; i < list.Length; i++)
                    {
                        //if (m_isStaticList)
                        //{
                        //    string test = Path.GetFileName(test_list[i].ToString());
                        //    if (!staticList.Contains(test))
                        //        continue;
                        //}
                        if (m_isProfilerRun)
                        {
                            list[i] = new ProfilerTest();
                        }
                        else
                        {
                            list[i] = new MicroFrameworkTest();
                        }
                        list[i].Name = test_list[i].ToString();
                        list[i].Location = test_list[i].ToString();
                    }
                }

                return list;
            }
Example #3
0
            private BaseTest[] BuildTestList(bool runTestsIndividually)
            {
                DirectoryInfo[] dirs;
                BaseTest[] list;

                if (runTestsIndividually)
                {
                    list = new BaseTest[m_runCount];

                    for (int i = 0; i < m_runCount; i++)
                    {
                        if (m_isProfilerRun)
                        {
                            list[i] = new ProfilerTest();
                        }
                        else
                        {
                            list[i] = new MicroFrameworkTest();
                        }
                        list[i].Name = m_test;
                        list[i].Location = m_test;
                    }
                }
                else
                {
                    // The machine is a test box with the sdk installation and not a dev box.
                    if (!IsDevEnvironment)
                    {
                        if (m_isProfilerRun)
                        {
                            dirs = new DirectoryInfo(string.Format("{0}ManagedProfilerTests",
                                InstallRoot)).GetDirectories();
                        }
                        else
                        {
                            dirs = new DirectoryInfo(string.Format("{0}TestCases",
                                InstallRoot)).GetDirectories();
                        }

                        list = BuildSolutionFileList(dirs);
                    }
                    else
                    {
                        // The machine is a dev box.
                        if (m_isProfilerRun)
                        {
                            dirs = new DirectoryInfo(string.Format(@"{0}Tests\Performance\ProfilerTests",
                                InstallRoot)).GetDirectories();
                            list = BuildSolutionFileList(dirs);
                        }
                        else
                        {
                            list = BuildSolutionFileList(InstallRoot + "build.dirproj");
                        }
                    }
                }

                return list;
            }