@@ -28,7 +28,7 @@ func TestShellPerformanceComparison(t *testing.T) {
28 assert.Equal(t, 0, exitCode)
28 assert.Equal(t, 0, exitCode)
29 assert.Contains(t, stdout, "hello")
29 assert.Contains(t, stdout, "hello")
30 assert.Empty(t, stderr)
30 assert.Empty(t, stderr)
32 t.Logf("Quick command took: %v", duration)
32 t.Logf("Quick command took: %v", duration)
@@ -48,13 +48,13 @@ func TestShellCPUUsageComparison(t *testing.T) {
48 start := time.Now()
48 start := time.Now()
49 _, stderr, exitCode, _, err := shell.Exec(context.Background(), "sleep 0.1", 1000)
49 _, stderr, exitCode, _, err := shell.Exec(context.Background(), "sleep 0.1", 1000)
50 duration := time.Since(start)
50 duration := time.Since(start)
52 runtime.ReadMemStats(&m2)
52 runtime.ReadMemStats(&m2)
54 require.NoError(t, err)
54 require.NoError(t, err)
55 assert.Equal(t, 0, exitCode)
55 assert.Equal(t, 0, exitCode)
56 assert.Empty(t, stderr)
56 assert.Empty(t, stderr)
58 memGrowth := m2.Alloc - m1.Alloc
58 memGrowth := m2.Alloc - m1.Alloc
59 t.Logf("Sleep 0.1s command took: %v", duration)
59 t.Logf("Sleep 0.1s command took: %v", duration)
60 t.Logf("Memory growth during polling: %d bytes", memGrowth)
60 t.Logf("Memory growth during polling: %d bytes", memGrowth)
@@ -72,7 +72,7 @@ func BenchmarkShellPolling(b *testing.B) {
73 b.ResetTimer()
73 b.ResetTimer()
74 b.ReportAllocs()
74 b.ReportAllocs()
76 for i := 0; i < b.N; i++ {
76 for i := 0; i < b.N; i++ {
77 // Use a short sleep to measure polling overhead
77 // Use a short sleep to measure polling overhead
78 _, _, exitCode, _, err := shell.Exec(context.Background(), "sleep 0.02", 500)
78 _, _, exitCode, _, err := shell.Exec(context.Background(), "sleep 0.02", 500)
@@ -80,4 +80,4 @@ func BenchmarkShellPolling(b *testing.B) {
80 b.Fatalf("Command failed: %v, exit code: %d", err, exitCode)
80 b.Fatalf("Command failed: %v, exit code: %d", err, exitCode)