mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
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:
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user