feat: output force quit (#29)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			Reviewed-on: FOCS-dev/JOJ3#29 Co-authored-by: Boming Zhang <bomingzh@sjtu.edu.cn> Co-committed-by: Boming Zhang <bomingzh@sjtu.edu.cn>
This commit is contained in:
		
							parent
							
								
									5ac760814d
								
							
						
					
					
						commit
						d46cebb906
					
				|  | @ -1 +1 @@ | ||||||
| Subproject commit 607ac46d3421fd145f2a1f0dbcba9e37f7563be9 | Subproject commit 34f1bcd9cf3e2905ecfd95284b25eae2568d38df | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit dc7be30db1fbfd83ecb78f214cff3f42732a1365 | Subproject commit 9f0d88eff4e9d7d3ac58f460609272f7d2e527e7 | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit 21f6df70d483f34a99b50335e0a1fbe50d3a82dd | Subproject commit a90071148cb7e39cf3e93b18a1e71632d7e974a3 | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit 0815ab90d72641fc274231c075282567e9e17865 | Subproject commit d33b07f18bf36c77dcf9a012d265dc7bd45fac9f | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit a7001564a22f9807119efb7b8f4cf6f74d4c12fc | Subproject commit 6d47ed4f6f7b8632784513edd8a206689503fc56 | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit 6cbfd9ff1ea95cd5c6c5f832e99cda6f9f2ea851 | Subproject commit 9cf0d994aa613dc38f2bc99f42d0dd7509c3d42c | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit b1afead762d2b2704823af83847c9155c6a1422b | Subproject commit c2fe51b4cd485339fd18924196b01eed6848ba1d | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit 51160e0a0cb01159fa264435865185083d756b06 | Subproject commit 9de8a32bc3a55f0652d487421384d0a163bf0aaa | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit f43b0b3a7b873ee935b19e4e5f26a8ceda7d3d61 | Subproject commit 9be8c3c329342059f49683a4e810938e8321adbe | ||||||
|  | @ -55,13 +55,13 @@ func (*Keyword) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 		return nil, true, err | 		return nil, true, err | ||||||
| 	} | 	} | ||||||
| 	var res []stage.ParserResult | 	var res []stage.ParserResult | ||||||
| 	end := false | 	forceQuit := false | ||||||
| 	for _, result := range results { | 	for _, result := range results { | ||||||
| 		tmp, matched := Parse(result, *conf) | 		tmp, matched := Parse(result, *conf) | ||||||
| 		if matched && conf.EndOnMatch { | 		if matched && conf.EndOnMatch { | ||||||
| 			end = true | 			forceQuit = true | ||||||
| 		} | 		} | ||||||
| 		res = append(res, tmp) | 		res = append(res, tmp) | ||||||
| 	} | 	} | ||||||
| 	return res, end, nil | 	return res, forceQuit, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -19,12 +19,12 @@ func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, true, err | 		return nil, true, err | ||||||
| 	} | 	} | ||||||
| 	end := false | 	forceQuit := false | ||||||
| 	var res []stage.ParserResult | 	var res []stage.ParserResult | ||||||
| 	for _, result := range results { | 	for _, result := range results { | ||||||
| 		comment := "" | 		comment := "" | ||||||
| 		if result.Status != stage.Status(envexec.StatusAccepted) { | 		if result.Status != stage.Status(envexec.StatusAccepted) { | ||||||
| 			end = true | 			forceQuit = true | ||||||
| 			comment = fmt.Sprintf( | 			comment = fmt.Sprintf( | ||||||
| 				"Unexpected executor status: %s.", result.Status, | 				"Unexpected executor status: %s.", result.Status, | ||||||
| 			) | 			) | ||||||
|  | @ -34,5 +34,5 @@ func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 			Comment: comment, | 			Comment: comment, | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| 	return res, end, nil | 	return res, forceQuit, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -164,6 +164,7 @@ type ParserResult struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type StageResult struct { | type StageResult struct { | ||||||
| 	Name    string         `json:"name"` | 	Name      string         `json:"name"` | ||||||
| 	Results []ParserResult `json:"results"` | 	Results   []ParserResult `json:"results"` | ||||||
|  | 	ForceQuit bool           `json:"force_quit"` | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -26,17 +26,18 @@ func Run(stages []Stage) []StageResult { | ||||||
| 			slog.Error("parser not found", "name", stage.ParserName) | 			slog.Error("parser not found", "name", stage.ParserName) | ||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 		parserResults, end, err := parser.Run(executorResults, stage.ParserConf) | 		parserResults, forceQuit, err := parser.Run(executorResults, stage.ParserConf) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			slog.Error("parser run error", "name", stage.ExecutorName, "error", err) | 			slog.Error("parser run error", "name", stage.ExecutorName, "error", err) | ||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 		slog.Debug("parser run done", "results", parserResults) | 		slog.Debug("parser run done", "results", parserResults) | ||||||
| 		stageResults = append(stageResults, StageResult{ | 		stageResults = append(stageResults, StageResult{ | ||||||
| 			Name:    stage.Name, | 			Name:      stage.Name, | ||||||
| 			Results: parserResults, | 			Results:   parserResults, | ||||||
|  | 			ForceQuit: forceQuit, | ||||||
| 		}) | 		}) | ||||||
| 		if end { | 		if forceQuit { | ||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -9,8 +9,8 @@ mkdir -p $submodules_dir | ||||||
| submodules=$(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') | submodules=$(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') | ||||||
| for submodule in $submodules; do | for submodule in $submodules; do | ||||||
|     url=$(git config --file .gitmodules --get-regexp "submodule.$submodule.url" | awk '{ print $2 }') |     url=$(git config --file .gitmodules --get-regexp "submodule.$submodule.url" | awk '{ print $2 }') | ||||||
|  |     branch=$(git config --file .gitmodules --get-regexp "submodule.$submodule.branch" | awk '{ print $2 }') | ||||||
|     repo_name=$(echo $url | rev | cut -d'/' -f 1 | rev | cut -d'.' -f 1) |     repo_name=$(echo $url | rev | cut -d'/' -f 1 | rev | cut -d'.' -f 1) | ||||||
|     commit=$(git submodule status $submodule | awk '{ print $1 }' | sed 's/^[+-]//') |  | ||||||
|     repo_dir="$tmp_dir/$repo_name" |     repo_dir="$tmp_dir/$repo_name" | ||||||
|     if [[ ! -v repo_names["$repo_name"] ]]; then |     if [[ ! -v repo_names["$repo_name"] ]]; then | ||||||
|         if [ ! -d "$repo_dir" ]; then |         if [ ! -d "$repo_dir" ]; then | ||||||
|  | @ -23,7 +23,7 @@ for submodule in $submodules; do | ||||||
|     fi |     fi | ||||||
|     repo_names[$repo_name]=1 |     repo_names[$repo_name]=1 | ||||||
|     cd $repo_dir |     cd $repo_dir | ||||||
|     git checkout -q $commit |     git checkout -q $branch | ||||||
|     cd - |     cd - | ||||||
|     submodule_dir="$submodules_dir/$repo_name/$submodule" |     submodule_dir="$submodules_dir/$repo_name/$submodule" | ||||||
|     mkdir -p $submodule_dir |     mkdir -p $submodule_dir | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user