fix(cmd/joj3/main_test.go,-examples/clang-tidy,-internal/parsers/clang_tidy): Switched clang-tidy's executor to sandbox
This commit is contained in:
parent
e133b13a84
commit
ecb2f02182
|
@ -53,9 +53,12 @@ func TestMain(t *testing.T) {
|
|||
{Score: 100, Comment: "executor status: run time: \\d+ ns, memory: \\d+ bytes"},
|
||||
}},
|
||||
}},
|
||||
{"clang_tidy", []stage.StageResult{
|
||||
{"clang-tidy", []stage.StageResult{
|
||||
{Name: "prepare", Results: []stage.ParserResult{
|
||||
{Score: 0, Comment: ""},
|
||||
}},
|
||||
{Name: "clang-tidy", Results: []stage.ParserResult{
|
||||
{Score: -200, Comment: ""},
|
||||
{Score: 10, Comment: ""},
|
||||
}},
|
||||
}},
|
||||
{"compile_error", []stage.StageResult{
|
||||
|
|
5
examples/clang-tidy/CMakeLists.txt
Normal file
5
examples/clang-tidy/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(MyProject)
|
||||
|
||||
add_executable(main sillycode.cpp)
|
62
examples/clang-tidy/conf.toml
Normal file
62
examples/clang-tidy/conf.toml
Normal file
|
@ -0,0 +1,62 @@
|
|||
skipGitea = true
|
||||
[[stages]]
|
||||
name = "prepare"
|
||||
[stages.executor]
|
||||
name = "sandbox"
|
||||
[stages.executor.with.default]
|
||||
args = ["cmake", "-S", ".", "-DDRONE=ON", "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", "-B", "build"]
|
||||
env = ["PATH=/usr/bin:/bin"]
|
||||
cpuLimit = 10_000_000_000
|
||||
memoryLimit = 104_857_600
|
||||
procLimit = 50
|
||||
copyInCwd = true
|
||||
copyOut = ["stdout"]
|
||||
copyOutCached = ["build/compile_commands.json"]
|
||||
[stages.executor.with.default.stdin]
|
||||
content = ""
|
||||
[stages.executor.with.default.stdout]
|
||||
name = "stdout"
|
||||
max = 65_536
|
||||
[stages.executor.with.default.stderr]
|
||||
name = "stderr"
|
||||
max = 65_536
|
||||
[stages.parser]
|
||||
name = "dummy"
|
||||
[stages.parser.with]
|
||||
score = 0
|
||||
comment = ""
|
||||
[[stages]]
|
||||
name = "clang-tidy"
|
||||
[stages.executor]
|
||||
name = "sandbox"
|
||||
[stages.executor.with.default]
|
||||
args = ["clang-tidy", "--header-filter=.*", "--quiet", "-checks=*", "sillycode.cpp", "-p", "build"]
|
||||
env = ["PATH=/usr/bin:/bin"]
|
||||
cpuLimit = 10_000_000_000
|
||||
memoryLimit = 104_857_600
|
||||
procLimit = 50
|
||||
copyInCwd = true
|
||||
copyOut = ["stdout"]
|
||||
[stages.executor.with.default.stdin]
|
||||
content = ""
|
||||
[stages.executor.with.default.stdout]
|
||||
name = "stdout"
|
||||
max = 65_536
|
||||
[stages.executor.with.default.stderr]
|
||||
name = "stderr"
|
||||
max = 65_536
|
||||
[stages.executor.with.default.copyInCached]
|
||||
"build/compile_commands.json" = "build/compile_commands.json"
|
||||
[stages.parser]
|
||||
name = "clang-tidy"
|
||||
[stages.parser.with]
|
||||
score = 100
|
||||
[[stages.parser.with.matches]]
|
||||
keyword = ["cppcoreguidelines-avoid-non-const-global-variables"]
|
||||
score = 5
|
||||
[[stages.parser.with.matches]]
|
||||
keyword = ["readability-identifier-length","misc-use-anonymous-namespace"]
|
||||
score = 2
|
||||
[[stages.parser.with.matches]]
|
||||
keyword = ["llvmlibc-implementation-in-namespace"]
|
||||
score = 0
|
1996
examples/clang_tidy/clangtidy_result.json
Normal file
1996
examples/clang_tidy/clangtidy_result.json
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -1,32 +0,0 @@
|
|||
skipGitea = true
|
||||
[[stages]]
|
||||
name = "clang-tidy"
|
||||
[stages.executor]
|
||||
name = "clang-tidy"
|
||||
[stages.executor.with.default]
|
||||
args = ["clang-tidy", "--header-filter=.*", "--quiet", "-checks=*", "sillycode.cpp"]
|
||||
env = ["PATH=/usr/bin:/bin"]
|
||||
[stages.executor.with.default.copyIn.dummy]
|
||||
src = "./../../build/dummy"
|
||||
copyOut = ["stdout", "stderr"]
|
||||
[stages.executor.with.default.stdin]
|
||||
content = ""
|
||||
[stages.executor.with.default.stdout]
|
||||
name = "stdout"
|
||||
max = 65_536
|
||||
[stages.executor.with.default.stderr]
|
||||
name = "stderr"
|
||||
max = 65_536
|
||||
[stages.parser]
|
||||
name = "clang-tidy"
|
||||
[stages.parser.with]
|
||||
score = 100
|
||||
[[stages.parser.with.matches]]
|
||||
keyword = ["cppcoreguidelines-avoid-non-const-global-variables"]
|
||||
score = 5
|
||||
[[stages.parser.with.matches]]
|
||||
keyword = ["readability-identifier-length","misc-use-anonymous-namespace"]
|
||||
score = 2
|
||||
[[stages.parser.with.matches]]
|
||||
keyword = ["llvmlibc-implementation-in-namespace"]
|
||||
score = 0
|
|
@ -2,7 +2,6 @@
|
|||
package clang_tidy
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
@ -111,7 +110,8 @@ func group_messages(messages []ClangMessage) []ClangMessage {
|
|||
}
|
||||
|
||||
func convert_paths_to_relative(messages *[]ClangMessage) {
|
||||
currentDir, _ := os.Getwd()
|
||||
// currentDir, _ := os.Getwd()
|
||||
currentDir := "/w"
|
||||
for i := range *messages {
|
||||
(*messages)[i].filepath, _ = filepath.Rel(currentDir, (*messages)[i].filepath)
|
||||
}
|
||||
|
|
|
@ -2,12 +2,10 @@ package clang_tidy
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
|
||||
"github.com/criyle/go-judge/envexec"
|
||||
)
|
||||
|
||||
type Match struct {
|
||||
|
@ -24,7 +22,6 @@ type ClangTidy struct{}
|
|||
|
||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||
stdout := executorResult.Files["stdout"]
|
||||
stderr := executorResult.Files["stderr"]
|
||||
|
||||
lines := strings.SplitAfter(stdout, "\n")
|
||||
messages := parse_lines(lines)
|
||||
|
@ -39,15 +36,15 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
|||
encoder.SetIndent("", " ")
|
||||
_ = encoder.Encode(formatted_messages)
|
||||
|
||||
if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
return stage.ParserResult{
|
||||
Score: 0,
|
||||
Comment: fmt.Sprintf(
|
||||
"Unexpected executor status: %s.\nStderr: %s",
|
||||
executorResult.Status, stderr,
|
||||
),
|
||||
}
|
||||
}
|
||||
// if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
// return stage.ParserResult{
|
||||
// Score: 0,
|
||||
// Comment: fmt.Sprintf(
|
||||
// "Unexpected executor status: %s.\nStderr: %s",
|
||||
// executorResult.Status, stderr,
|
||||
// ),
|
||||
// }
|
||||
// }
|
||||
return stage.ParserResult{
|
||||
Score: get_score(formatted_messages, conf),
|
||||
Comment: "",
|
||||
|
|
Loading…
Reference in New Issue
Block a user