Fix sniffer_test to work.

Previously, run_sniffer was not correctly reporting when unsupported ioctls
were found with the compatibility flag set. At the same time, the sniffer test
was not correctly testing a supported CUDA program, since it was using
run_sample which is currently broken with the sniffer.

This also adds the sniffer test to the list of gpu tests.

PiperOrigin-RevId: 663911778
This commit is contained in:
Anthony Cui
2024-08-16 16:34:11 -07:00
committed by gVisor bot
parent 834bef5996
commit 6199fc8395
3 changed files with 10 additions and 4 deletions
+2
View File
@@ -308,6 +308,7 @@ gpu-all-tests: gpu-images gpu-smoke-tests $(RUNTIME_BIN)
@$(call sudo,test/gpu:imagegen_test,--runtime=$(RUNTIME) -test.v $(ARGS))
@$(call sudo,test/gpu:sr_test,--runtime=$(RUNTIME) -test.v $(ARGS))
@$(call sudo,test/gpu:nccl_test,--runtime=$(RUNTIME) -test.v $(ARGS))
@$(call test,--test_env=RUNTIME=$(RUNTIME) test/gpu:sniffer_test)
.PHONY: gpu-all-tests
cos-gpu-all-tests: gpu-images cos-gpu-smoke-tests $(RUNTIME_BIN)
@@ -317,6 +318,7 @@ cos-gpu-all-tests: gpu-images cos-gpu-smoke-tests $(RUNTIME_BIN)
@$(call sudo,test/gpu:imagegen_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
@$(call sudo,test/gpu:sr_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
@$(call sudo,test/gpu:nccl_test,--runtime=$(RUNTIME) -test.v --cos-gpu $(ARGS))
@$(call test,--test_env=RUNTIME=$(RUNTIME) --test_arg="--cos-gpu" test/gpu:sniffer_test)
.PHONY: cos-gpu-all-tests
portforward-tests: load-basic_redis load-basic_nginx $(RUNTIME_BIN)
+4 -4
View File
@@ -32,7 +32,7 @@ const maxDuration = 1 * time.Minute
// RunCommand runs the given command via the sniffer, with the -enforce_compatibility flag.
//
// It's run in a docker container, with the cuda-tests image.
func runCommand(t *testing.T, cmd ...string) (string, error) {
func runCUDATestsCommand(t *testing.T, cmd ...string) (string, error) {
// Find the sniffer binary
cliPath, err := testutil.FindFile("tools/ioctl_sniffer/run_sniffer")
if err != nil {
@@ -62,19 +62,19 @@ func runCommand(t *testing.T, cmd ...string) (string, error) {
}
func TestSupportedCUDAProgram(t *testing.T) {
output, err := runCommand(t, "/run_sample", "0_Introduction/vectorAdd")
output, err := runCUDATestsCommand(t, "/run_smoke.sh")
t.Logf("%s", output)
if err != nil {
t.Logf("Error: %v", err)
if strings.Contains(output, "unsupported ioctls found") {
t.Fatalf("'unsupported ioctls found' found in output")
}
t.Fatalf("Failed to run vectorAdd")
t.Fatalf("Failed to run run_smoke.sh")
}
}
func TestUnsupportedCUDAProgram(t *testing.T) {
output, err := runCommand(t, "/unsupported_ioctl")
output, err := runCUDATestsCommand(t, "/unsupported_ioctl")
t.Logf("%s", output)
if err == nil {
t.Fatalf("Expected run_sniffer to fail")
+4
View File
@@ -115,6 +115,10 @@ func Main(ctx context.Context) error {
// Merge results from each connection.
finalResults := server.AllResults()
if *enforceCompatability && finalResults.HasUnsupportedIoctl() {
return fmt.Errorf("unsupported ioctls found: %v", finalResults)
}
log.Infof("============== Unsupported ioctls ==============")
log.Infof("%v", finalResults)