Esempio n. 1
0
        public string RunCheck()
        {
            try{
                bool   ok;
                string directory_path = Directory.GetCurrentDirectory() + "/Check_" + check_location;
                ok = CopyAll(files_location, directory_path);
                if (!ok)
                {
                    return("Cannot Load files at " + files_location);
                }
                string output = "";
                string errors = "";

                ProcessStartInfo start = new ProcessStartInfo();
                start.FileName               = exe_file_location;
                start.Arguments              = directory_path;
                start.UseShellExecute        = false;
                start.RedirectStandardOutput = true;
                start.RedirectStandardError  = true;
                start.RedirectStandardInput  = true;
                start.WorkingDirectory       = Directory.GetCurrentDirectory();

                using (Process process = Process.Start(start))
                {
                    //wait until timeout:
                    bool exited = process.WaitForExit(5000);
                    if (!exited)
                    {
                        return("Timeout");
                    }
                    using (StreamReader reader = process.StandardOutput)
                    {
                        output = reader.ReadToEnd();
                    }
                    using (StreamReader reader = process.StandardError)
                    {
                        errors = errors + reader.ReadToEnd();
                    }
                }
                if (errors.Length > 0)
                {
                    return("Error: " + errors);
                }
                else
                {
                    bool is_ok = (output == "");
                    this.result = new CheckStyleResult(is_ok, output);
                }
                Directory.Delete(directory_path, true);
                return("OK");
            }catch (Exception ex) {
                return("Exception " + ex.Message);
            }
        }
Esempio n. 2
0
 public Result(List <CheckResult> test_results)
 {
     this.Test_Results       = test_results;
     this.Check_Style_Result = null;
 }
Esempio n. 3
0
 public Result(CheckStyleResult check_style_result)
 {
     this.Test_Results       = null;
     this.Check_Style_Result = check_style_result;
 }
Esempio n. 4
0
 public Result()
 {
     this.Test_Results       = null;
     this.Check_Style_Result = null;
 }