aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn/TestExe/Program.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-22 17:12:34 -0700
committerRob Mensching <rob@firegiant.com>2021-05-05 11:18:35 -0700
commitd8e47230e094a506406a83eb78916abf2668b29c (patch)
tree2213ee3ed1a19fd5cd19a5914a23b7f7a57318ff /src/test/burn/TestExe/Program.cs
parent2cbe83832cc76aa379b29665de5523e82c543acf (diff)
downloadwix-d8e47230e094a506406a83eb78916abf2668b29c.tar.gz
wix-d8e47230e094a506406a83eb78916abf2668b29c.tar.bz2
wix-d8e47230e094a506406a83eb78916abf2668b29c.zip
Move Integration into test
Diffstat (limited to 'src/test/burn/TestExe/Program.cs')
-rw-r--r--src/test/burn/TestExe/Program.cs74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/test/burn/TestExe/Program.cs b/src/test/burn/TestExe/Program.cs
new file mode 100644
index 00000000..e92c413b
--- /dev/null
+++ b/src/test/burn/TestExe/Program.cs
@@ -0,0 +1,74 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3using System;
4using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7
8namespace TestExe
9{
10 class Program
11 {
12 static List<Task> tasks;
13 static int exitCodeToReturn = 0;
14
15 static int Main(string[] args)
16 {
17 Usage();
18 tasks = TaskParser.ParseTasks(args);
19
20 foreach (Task t in tasks)
21 {
22 // special case for the ExitCodeTask
23 if (t.GetType() == typeof(ExitCodeTask))
24 {
25 exitCodeToReturn = int.Parse(t.data);
26 }
27 else
28 {
29 t.RunTask();
30 }
31 }
32
33 Console.WriteLine("Exiting with ExitCode = {0}", exitCodeToReturn);
34 return exitCodeToReturn;
35 }
36
37 static void Usage()
38 {
39 Console.WriteLine(@"TestExe.exe");
40 Console.WriteLine(@"");
41 Console.WriteLine(@"TestExe can be passed various switches to define how it will behave and what tasks it will perform.");
42 Console.WriteLine(@"All switches are optional.");
43 Console.WriteLine(@"Any # of switches can be combined in any order.");
44 Console.WriteLine(@"Switches can be specified multiple times.");
45 Console.WriteLine(@"The order of the switches listed is the order they will be processed.");
46 Console.WriteLine(@"Info is written to stdout to describe what tasks are being performed as they are executed.");
47 Console.WriteLine(@"");
48 Console.WriteLine(@"Usage: TestExe.exe [tasks...]");
49 Console.WriteLine(@"");
50 Console.WriteLine(@"");
51 Console.WriteLine(@"/ec # Exit code to return. Can only be specified once. If not specified, 0 will be returned. Example: “/ec 3010” would return 3010");
52 Console.WriteLine(@"/s # Milliseconds to sleep before continuing. Example: “/s 5000” would sleep 5 seconds.");
53 Console.WriteLine(@"/sr #-# Random range of Milliseconds to sleep before continuing. Example: “/sr 5000-10000” would sleep between 5-10 seconds.");
54 Console.WriteLine(@"/log filename Create a log file called filename. Contents of the log are static text. Example: “/log %temp%\test.log” would create a %temp%\test.log file.");
55 Console.WriteLine(@"/Pinfo filename Create an xml file containing information about the process: PID, start time, user running the process, etc.");
56 Console.WriteLine(@"/fe filename Wait for a file to exist before continuing. Example: “/fe %temp%\cache\file.msi” would wait until %temp%\cache\file.msi exists.");
57 Console.WriteLine(@"/regw regkey,name,type,value (Re)writes a registry key with the specified value");
58 Console.WriteLine(@"/regd regkey,[name] Deletes registry key name or key and all of its children (subkeys and values)");
59 Console.WriteLine(@"");
60 Console.WriteLine(@"Example: ");
61 Console.WriteLine(@"");
62 Console.WriteLine(@"TestExe.exe /ec 1603 /Pinfo %temp%\Pinfo1.xml /s 1000 /log %temp%\log1.log /sr 5000-10000 /log %temp%\log2.log");
63 Console.WriteLine(@"");
64 Console.WriteLine(@"This would result in the following execution:");
65 Console.WriteLine(@" - Create an xml file with the current process info in it.");
66 Console.WriteLine(@" - Sleep 1 seconds");
67 Console.WriteLine(@" - Create log1.log");
68 Console.WriteLine(@" - Sleep between 5-10 seconds");
69 Console.WriteLine(@" - Create log2.log");
70 Console.WriteLine(@" - Exit with 1603");
71 Console.WriteLine(@"");
72 }
73 }
74}