Fix misspellings and assembly references
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Tue, 3 Apr 2018 08:35:33 +0000 (11:35 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Tue, 3 Apr 2018 14:38:53 +0000 (17:38 +0300)
tests/README.md
tests/ValuesTest/ValuesTest.cs
tests/run_tests_sdb.sh
tests/runner/Runner.cs

index 2f4da6fb2b0491b1873e52c7efc05738f2e96100..565604011661471661f5fe5781851c78201f7717 100644 (file)
@@ -2,15 +2,15 @@
 
 ## Running tests
 
-Before running tests the debugger should be built and installed inside `./bin` directory, `dotnet` CLI shoud be present in `PATH`.
+By default test runner looks for debugger binary in `./bin` directory and expects `dotnet` CLI to be present in `PATH`.
 
-From project root directory test are run through dotnet CLI:
+Test are run through dotnet CLI from the project root directory:
 ```
 cd tests
 dotnet test
 ```
 
-It is possible to override path to the debugger binary through `PIPE` environgment variable:
+It is possible to override path to the debugger binary through `PIPE` environment variable:
 ```
 cd tests
 PIPE=<path-to-debugger> dotnet test --logger "trx;LogFileName=$PWD/Results.trx"
@@ -20,7 +20,7 @@ PIPE=<path-to-debugger> dotnet test --logger "trx;LogFileName=$PWD/Results.trx"
 
 Test results can be exported to a file with `--logger` command line option.
 
-By default test binaries are descovered recursively under project `tests` directory. When tests should be executed on another machine, environment variable `TESTDIR` can override the location of test binaries. In that case recursive search is not performed and all test binaries should be located directly under `TESTDIR`. So for `TESTDIR=/tmp` the test binary files layout shoud be:
+By default test binaries are discovered recursively under project `tests` directory. When tests should be executed on another machine, environment variable `TESTDIR` can override the location of test binaries. In that case recursive search is not performed and all test binaries should be located directly under `TESTDIR`. So for `TESTDIR=/tmp` the test binary files layout shoud be:
 ```
 /tmp/Example1Test.dll
 /tmp/Example1Test.pdb
@@ -65,7 +65,6 @@ Test scenario should be present in comments inside TestExample/Program.cs
 
 The following example instructs the debugger to run test binary and verifies that the debugger stops at line with `@START@` tag with stop reason `entry-point-hit`:
 ```
-using System;
 /*
 Send("1-file-exec-and-symbols dotnet");
 Send("2-exec-arguments " + TestBin);
@@ -75,6 +74,8 @@ var r = Expect("*stopped");
 Assert.Equal(r.FindString("reason"), "entry-point-hit");
 Assert.Equal(r.Find("frame").FindInt("line"), Lines["START"]);
 */
+using System;
+
 namespace ExampleTest
 {
     class Program
index 9e2c36a6e7fe44d046e5cd3d36b93c10e6c351f0..e1275ca2990a3461c35327a38e4daafbcb12d3d1 100644 (file)
@@ -1,6 +1,4 @@
 /*
-using System;
-
 Send("1-file-exec-and-symbols dotnet");
 Send("2-exec-arguments " + TestBin);
 Send("3-exec-run");
index 57fe948cc66fffa1cf34387e25d40a8fbbd346b0..b670d848ca9b5051ce6e86c83fecf3b70c1c4fe4 100755 (executable)
@@ -6,7 +6,7 @@
 #   3. Install netcoredbg rpm:   sdb push netcoredbg-*.rpm /tmp && sdb shell rpm -i --force /tmp/netcoredbg-*.rpm
 #   4. Create dotnet symlink:    sdb shell ln -s /usr/share/dotnet/corerun /usr/bin/dotnet
 
-SDB=${SDB:=sdb}
+SDB=${SDB:-sdb}
 
 SCRIPTDIR=$(dirname $(readlink -f $0))
 
@@ -14,11 +14,15 @@ SCRIPTDIR=$(dirname $(readlink -f $0))
 find $SCRIPTDIR -name '*Test.runtimeconfig.json' | while read fname; do
   base=$(echo $fname | rev | cut -f 3- -d '.' | rev)
   $SDB push ${base}.dll ${base}.pdb /tmp
-  #$SDB shell chsmack -a '*' /tmp/$(basename ${base}.dll) /tmp/$(basename ${base}.pdb)
+  # After push some targets set SMACK access label to System, but the debugger can not access System files.
+  # Also, prevent sdb from consuming input.
+  cat /dev/null | $SDB shell "chsmack -a '*' /tmp/$(basename ${base}).dll /tmp/$(basename ${base}).pdb"
 done
 
 # Run tests
 
 DEBUGGER=/home/owner/share/tmp/sdk_tools/netcoredbg/netcoredbg
 
+# sdb always allocates a terminal for a shell command, but we do not want MI commands to be echoed.
+# So we need to delay stdin by 1 second and hope that `stty raw -echo` turns the echo off during the delay.
 TESTDIR=/tmp PIPE="(sleep 1; cat) | $SDB shell stty raw -echo\\;$DEBUGGER --interpreter=mi" dotnet test $SCRIPTDIR --logger "trx;LogFileName=$SCRIPTDIR/Results.trx"
index 0707f2e2cc96dadb9e01a9fc46f91c2a18dfbb54..e43a0d188608777256d383f3405a46f06376ad59 100644 (file)
@@ -308,8 +308,8 @@ namespace Runner
                 cc.Text,
                 ScriptOptions.Default.WithReferences(typeof(object).Assembly)
                                      .WithReferences(typeof(Xunit.Assert).Assembly)
-                                     .WithImports("System")
-                                     .WithImports("Xunit"),
+                                     .WithReferences(typeof(MICore.MIResults).Assembly)
+                                     .WithImports(new string[]{"System", "Xunit", "MICore"}),
                 globalsType: typeof(TestCaseGlobals)
             );
             script.Compile();