diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcc1fb2a0ab95..5d77eb392b6bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,6 +67,26 @@ jobs: package-manager-cache: false - run: npm ci --registry=https://packagefeedproxy.microsoft.io/npm/ + go-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: ./.github/actions/setup-go + - name: Prepare standalone tsc module + run: | + mkdir "$RUNNER_TEMP/go-test-bin" + ln -s "$(go env GOROOT)/bin/go" "$RUNNER_TEMP/go-test-bin/go" + cp -R tsc "$RUNNER_TEMP/tsc" + - name: Tests without Node.js + run: | + export PATH="$RUNNER_TEMP/go-test-bin" + export GOEXPERIMENT=ms_nocgo_opensslcrypto + export CGO_ENABLED=0 + ! command -v node + cd "$RUNNER_TEMP/tsc" + go test ./... + go test -run=- -bench=. -benchtime=1x ./... + test: strategy: fail-fast: ${{ github.event_name == 'merge_group' }} @@ -307,6 +327,7 @@ jobs: - extension - format - generate + - go-test - lint - misc - package-feed-proxy diff --git a/tsc/cmd/tsc/sys_unix_test.go b/tsc/cmd/tsc/sys_unix_test.go index 4192f1acce600..c2a52b69575fd 100644 --- a/tsc/cmd/tsc/sys_unix_test.go +++ b/tsc/cmd/tsc/sys_unix_test.go @@ -5,6 +5,9 @@ package main import ( "bufio" "bytes" + "fmt" + "os" + "os/exec" "strconv" "strings" "syscall" @@ -15,8 +18,32 @@ import ( ) func TestChildProcessCloseDoesNotWaitForLauncherDescendants(t *testing.T) { + const ( + launcherArg = "child-process-launcher" + descendantArg = "child-process-descendant" + ) + if len(os.Args) > 1 { + switch os.Args[len(os.Args)-1] { + case launcherArg: + cmd := exec.Command(os.Args[0], "-test.run=^TestChildProcessCloseDoesNotWaitForLauncherDescendants$", "--", descendantArg) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + assert.NilError(t, cmd.Start()) + fmt.Println(cmd.Process.Pid) + assert.NilError(t, cmd.Wait()) + return + case descendantArg: + time.Sleep(time.Minute) + return + } + } + t.Parallel() - process, err := spawnProcess([]string{"sh", "-c", "nohup sleep 60 & echo $!; wait"}, "", &bytes.Buffer{}) + process, err := spawnProcess( + []string{os.Args[0], "-test.run=^TestChildProcessCloseDoesNotWaitForLauncherDescendants$", "--", launcherArg}, + "", + &bytes.Buffer{}, + ) assert.NilError(t, err) pidText, err := bufio.NewReader(process).ReadString('\n') assert.NilError(t, err)