feat: add flag to count internal errors as part of the success rate
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							| @@ -115,7 +115,7 @@ jobs: | |||||||
|         echo 'WorkingDirectory=/root/test' >> test.service |         echo 'WorkingDirectory=/root/test' >> test.service | ||||||
|         echo 'TimeoutStopSec=1' >> test.service |         echo 'TimeoutStopSec=1' >> test.service | ||||||
|         echo 'ExecStart=/usr/local/bin/out-of-tree kernel autogen --threads=4 --max=256 --shuffle' >> test.service |         echo 'ExecStart=/usr/local/bin/out-of-tree kernel autogen --threads=4 --max=256 --shuffle' >> test.service | ||||||
|         echo 'ExecStart=/usr/local/bin/out-of-tree pew --qemu-timeout=4m --threads=4' >> test.service |         echo 'ExecStart=/usr/local/bin/out-of-tree pew --qemu-timeout=4m --threads=4 --include-internal-errors' >> test.service | ||||||
|  |  | ||||||
|         scp test.service root@$IP:/etc/systemd/system/test.service |         scp test.service root@$IP:/etc/systemd/system/test.service | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								pew.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								pew.go
									
									
									
									
									
								
							| @@ -50,7 +50,8 @@ type PewCmd struct { | |||||||
| 	QemuAfterStartTimeout time.Duration `help:"timeout after starting of the qemu vm before tests"` | 	QemuAfterStartTimeout time.Duration `help:"timeout after starting of the qemu vm before tests"` | ||||||
| 	DockerTimeout         time.Duration `help:"timeout for docker"` | 	DockerTimeout         time.Duration `help:"timeout for docker"` | ||||||
|  |  | ||||||
| 	Threshold float64 `help:"reliablity threshold for exit code" default:"1.00"` | 	Threshold             float64 `help:"reliablity threshold for exit code" default:"1.00"` | ||||||
|  | 	IncludeInternalErrors bool    `help:"count internal errors as part of the success rate"` | ||||||
|  |  | ||||||
| 	Endless        bool          `help:"endless tests"` | 	Endless        bool          `help:"endless tests"` | ||||||
| 	EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"` | 	EndlessTimeout time.Duration `help:"timeout between tests" default:"1m"` | ||||||
| @@ -140,9 +141,16 @@ func (cmd *PewCmd) Run(g *Globals) (err error) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if state.InternalErrors > 0 { | 	if state.InternalErrors > 0 { | ||||||
|  | 		s := "not counted towards success rate" | ||||||
|  | 		if cmd.IncludeInternalErrors { | ||||||
|  | 			s = "included in success rate" | ||||||
|  | 		} | ||||||
| 		log.Warn().Msgf("%d internal errors "+ | 		log.Warn().Msgf("%d internal errors "+ | ||||||
| 			"(not counted towards success rate)", | 			"(%s)", state.InternalErrors, s) | ||||||
| 			state.InternalErrors) | 	} | ||||||
|  |  | ||||||
|  | 	if cmd.IncludeInternalErrors { | ||||||
|  | 		state.Overall += float64(state.InternalErrors) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	msg := fmt.Sprintf("Success rate: %.02f (%d/%d), Threshold: %.02f", | 	msg := fmt.Sprintf("Success rate: %.02f (%d/%d), Threshold: %.02f", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user