tests: fix data race in bad-block-report disabling during tests
This commit is contained in:
		
							parent
							
								
									e3f36d9728
								
							
						
					
					
						commit
						9dc5de51a2
					
				@ -56,13 +56,16 @@ var (
 | 
				
			|||||||
	VmSkipTests    = []string{}
 | 
						VmSkipTests    = []string{}
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Disable reporting bad blocks for the tests
 | 
				
			||||||
 | 
					func init() {
 | 
				
			||||||
 | 
						core.DisableBadBlockReporting = true
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func readJson(reader io.Reader, value interface{}) error {
 | 
					func readJson(reader io.Reader, value interface{}) error {
 | 
				
			||||||
	data, err := ioutil.ReadAll(reader)
 | 
						data, err := ioutil.ReadAll(reader)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("Error reading JSON file", err.Error())
 | 
							return fmt.Errorf("Error reading JSON file", err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	core.DisableBadBlockReporting = true
 | 
					 | 
				
			||||||
	if err = json.Unmarshal(data, &value); err != nil {
 | 
						if err = json.Unmarshal(data, &value); err != nil {
 | 
				
			||||||
		if syntaxerr, ok := err.(*json.SyntaxError); ok {
 | 
							if syntaxerr, ok := err.(*json.SyntaxError); ok {
 | 
				
			||||||
			line := findLine(data, syntaxerr.Offset)
 | 
								line := findLine(data, syntaxerr.Offset)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user