Run tests using the deqp-stdin-caselist option

In order to run multiple tests in each instance, we need to switch
from using the "-n" option to using the "deqp-stdin-caselist", which
allows providing a '\n' separated list of tests through stdin.

This CL still only runs a single test per call, so this change should
be noop.

Bug: b/253530501
Change-Id: Ifef4df61075562327878ce78ac017821a50d18a5
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/69010
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
diff --git a/tests/regres/deqp/deqp.go b/tests/regres/deqp/deqp.go
index a03f730..1e49a74 100644
--- a/tests/regres/deqp/deqp.go
+++ b/tests/regres/deqp/deqp.go
@@ -327,7 +327,10 @@
 		validation = "enable"
 	}
 
-	outRaw, err := shell.Exec(c.TestTimeout, exe, filepath.Dir(exe), env,
+	// The list of test names will be passed to stdin, since the deqp-stdin-caselist option is used
+	testNames := name + "\n"
+
+	outRaw, err := shell.Exec(c.TestTimeout, exe, filepath.Dir(exe), env, testNames,
 		"--deqp-validation="+validation,
 		"--deqp-surface-type=pbuffer",
 		"--deqp-shadercache=disable",
@@ -337,7 +340,7 @@
 		"--deqp-log-empty-loginfo=disable",
 		"--deqp-log-flush=disable",
 		"--deqp-log-filename="+logPath,
-		"-n="+name)
+		"--deqp-stdin-caselist")
 	duration := time.Since(start)
 	out := string(outRaw)
 	out = strings.ReplaceAll(out, exe, "<dEQP>")
diff --git a/tests/regres/shell/shell.go b/tests/regres/shell/shell.go
index 2d45398..5cd728d 100644
--- a/tests/regres/shell/shell.go
+++ b/tests/regres/shell/shell.go
@@ -38,7 +38,7 @@
 // directory wd, with the custom env.
 // If the process does not finish within timeout a errTimeout will be returned.
 func Env(timeout time.Duration, exe, wd string, env []string, args ...string) error {
-	if out, err := Exec(timeout, exe, wd, env, args...); err != nil {
+	if out, err := Exec(timeout, exe, wd, env, "", args...); err != nil {
 		return cause.Wrap(err, "%s", out)
 	}
 	return nil
diff --git a/tests/regres/shell/shell_unix.go b/tests/regres/shell/shell_unix.go
index 59fd599..4d73ddf 100644
--- a/tests/regres/shell/shell_unix.go
+++ b/tests/regres/shell/shell_unix.go
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build darwin || linux
 // +build darwin linux
 
 package shell
@@ -84,7 +85,10 @@
 // Exec runs the executable exe with the given arguments, in the working
 // directory wd, with the custom environment flags.
 // If the process does not finish within timeout a errTimeout will be returned.
-func Exec(timeout time.Duration, exe, wd string, env []string, args ...string) ([]byte, error) {
+func Exec(timeout time.Duration, exe, wd string, env []string, toStdin string, args ...string) ([]byte, error) {
+	stdin := &bytes.Buffer{}
+	stdin.WriteString(toStdin)
+
 	// Shell via regres: --exec N <exe> <args...>
 	// See main() for details.
 	args = append([]string{"--exec", exe, fmt.Sprintf("%v", MaxProcMemory)}, args...)
@@ -92,6 +96,7 @@
 	c := exec.Command(os.Args[0], args...)
 	c.Dir = wd
 	c.Env = env
+	c.Stdin = stdin
 	c.Stdout = &b
 	c.Stderr = &b
 
diff --git a/tests/regres/shell/shell_windows.go b/tests/regres/shell/shell_windows.go
index cf193d4..aba350d 100644
--- a/tests/regres/shell/shell_windows.go
+++ b/tests/regres/shell/shell_windows.go
@@ -23,11 +23,15 @@
 // Exec runs the executable exe with the given arguments, in the working
 // directory wd, with the custom environment flags.
 // If the process does not finish within timeout a errTimeout will be returned.
-func Exec(timeout time.Duration, exe, wd string, env []string, args ...string) ([]byte, error) {
+func Exec(timeout time.Duration, exe, wd string, env []string, toStdin string, args ...string) ([]byte, error) {
+	stdin := &bytes.Buffer{}
+	stdin.WriteString(toStdin)
+
 	b := bytes.Buffer{}
 	c := exec.Command(exe, args...)
 	c.Dir = wd
 	c.Env = env
+	c.Stdin = stdin
 	c.Stdout = &b
 	c.Stderr = &b