| 800 | } |
| 801 | |
| 802 | func BenchmarkTenPrograms(b *testing.B) { |
| 803 | ctx := context.Background() |
| 804 | |
| 805 | for i := 0; i < b.N; i++ { |
| 806 | p := pipe.New() |
| 807 | p.Add( |
| 808 | pipe.Command("echo", "hello world"), |
| 809 | pipe.Command("cat"), |
| 810 | pipe.Command("cat"), |
| 811 | pipe.Command("cat"), |
| 812 | pipe.Command("cat"), |
| 813 | pipe.Command("cat"), |
| 814 | pipe.Command("cat"), |
| 815 | pipe.Command("cat"), |
| 816 | pipe.Command("cat"), |
| 817 | pipe.Command("cat"), |
| 818 | ) |
| 819 | out, err := p.Output(ctx) |
| 820 | if assert.NoError(b, err) { |
| 821 | assert.EqualValues(b, "hello world\n", out) |
| 822 | } |
| 823 | } |
| 824 | } |
| 825 | |
| 826 | func BenchmarkTenFunctions(b *testing.B) { |
| 827 | ctx := context.Background() |