chore: rename dummy -> sample
This commit is contained in:
parent
f81581b928
commit
2928e6321f
12
.gitmodules
vendored
12
.gitmodules
vendored
|
@ -10,14 +10,14 @@
|
||||||
path = examples/compile/error
|
path = examples/compile/error
|
||||||
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
||||||
branch = compile/error
|
branch = compile/error
|
||||||
[submodule "examples/dummy/success"]
|
[submodule "examples/sample/success"]
|
||||||
path = examples/dummy/success
|
path = examples/sample/success
|
||||||
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
||||||
branch = dummy/success
|
branch = sample/success
|
||||||
[submodule "examples/dummy/error"]
|
[submodule "examples/sample/error"]
|
||||||
path = examples/dummy/error
|
path = examples/sample/error
|
||||||
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
||||||
branch = dummy/error
|
branch = sample/error
|
||||||
[submodule "examples/keyword/cpplint/sillycode"]
|
[submodule "examples/keyword/cpplint/sillycode"]
|
||||||
path = examples/keyword/cpplint/sillycode
|
path = examples/keyword/cpplint/sillycode
|
||||||
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
url = ssh://git@focs.ji.sjtu.edu.cn:2222/FOCS-dev/JOJ3-examples.git
|
||||||
|
|
30
README.md
30
README.md
|
@ -40,35 +40,7 @@ Note: you may fail the test if the checking tools are not installed. e.g. For th
|
||||||
```bash
|
```bash
|
||||||
$ make test
|
$ make test
|
||||||
go test -coverprofile cover.out -v ./...
|
go test -coverprofile cover.out -v ./...
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/cmd/dummy coverage: 0.0% of statements
|
...
|
||||||
? focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors [no test files]
|
|
||||||
? focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers [no test files]
|
|
||||||
? focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/healthcheck [no test files]
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors/dummy coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/cpplint coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/diff coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/dummy coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/keyword coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/dummy coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/executors/sandbox coverage: 0.0% of statements
|
|
||||||
focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/resultstatus coverage: 0.0% of statements
|
|
||||||
=== RUN TestMain
|
|
||||||
=== RUN TestMain/compile/error
|
|
||||||
=== RUN TestMain/compile/success
|
|
||||||
=== RUN TestMain/cpplint/sillycode
|
|
||||||
=== RUN TestMain/dummy/error
|
|
||||||
=== RUN TestMain/dummy/success
|
|
||||||
=== RUN TestMain/keyword/clang-tidy/sillycode
|
|
||||||
=== RUN TestMain/keyword/cpplint/sillycode
|
|
||||||
--- PASS: TestMain (2.28s)
|
|
||||||
--- PASS: TestMain/compile/error (0.03s)
|
|
||||||
--- PASS: TestMain/compile/success (0.42s)
|
|
||||||
--- PASS: TestMain/cpplint/sillycode (0.14s)
|
|
||||||
--- PASS: TestMain/dummy/error (0.01s)
|
|
||||||
--- PASS: TestMain/dummy/success (0.01s)
|
|
||||||
--- PASS: TestMain/keyword/clang-tidy/sillycode (1.57s)
|
|
||||||
--- PASS: TestMain/keyword/cpplint/sillycode (0.11s)
|
|
||||||
PASS
|
PASS
|
||||||
coverage: 74.0% of statements
|
coverage: 74.0% of statements
|
||||||
ok focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/cmd/joj3 2.290s coverage: 74.0% of statements
|
ok focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/cmd/joj3 2.290s coverage: 74.0% of statements
|
||||||
|
|
|
@ -6,13 +6,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/dummy"
|
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/sample"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
score := flag.Int("score", 0, "score")
|
score := flag.Int("score", 0, "score")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
res, err := dummy.Run(dummy.Conf{Score: *score})
|
res, err := sample.Run(sample.Conf{Score: *score})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprint(os.Stderr, err)
|
fmt.Fprint(os.Stderr, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 8571a8ba30fb2c431d504ed9cfc74d33b9820246
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit a933d18dda38446d96e36ec5032c6dd48546511b
|
|
1
examples/sample/error
Submodule
1
examples/sample/error
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit aa5bf333e30c9c0175e021c001d85f90092d7d1a
|
1
examples/sample/success
Submodule
1
examples/sample/success
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit ed17357671e1c6f8aa7f534a482d9b2fac76d959
|
|
@ -5,9 +5,9 @@ import (
|
||||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/cppcheck"
|
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/cppcheck"
|
||||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/cpplint"
|
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/cpplint"
|
||||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/diff"
|
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/diff"
|
||||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/dummy"
|
|
||||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/keyword"
|
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/keyword"
|
||||||
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/resultstatus"
|
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/resultstatus"
|
||||||
|
_ "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/parsers/sample"
|
||||||
)
|
)
|
||||||
|
|
||||||
// this file does nothing but imports to ensure all the init() functions
|
// this file does nothing but imports to ensure all the init() functions
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package dummy
|
package sample
|
||||||
|
|
||||||
import "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
|
import "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
|
||||||
|
|
||||||
var name = "dummy"
|
var name = "sample"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
stage.RegisterParser(name, &Dummy{})
|
stage.RegisterParser(name, &Sample{})
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package dummy
|
package sample
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
|
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
|
||||||
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/dummy"
|
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/pkg/sample"
|
||||||
"github.com/criyle/go-judge/envexec"
|
"github.com/criyle/go-judge/envexec"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ type Conf struct {
|
||||||
Comment string
|
Comment string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Dummy struct{}
|
type Sample struct{}
|
||||||
|
|
||||||
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||||
stdout := executorResult.Files["stdout"]
|
stdout := executorResult.Files["stdout"]
|
||||||
|
@ -28,8 +28,8 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dummyResult dummy.Result
|
var sampleResult sample.Result
|
||||||
err := json.Unmarshal([]byte(stdout), &dummyResult)
|
err := json.Unmarshal([]byte(stdout), &sampleResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return stage.ParserResult{
|
return stage.ParserResult{
|
||||||
Score: 0,
|
Score: 0,
|
||||||
|
@ -37,12 +37,12 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stage.ParserResult{
|
return stage.ParserResult{
|
||||||
Score: dummyResult.Score + conf.Score,
|
Score: sampleResult.Score + conf.Score,
|
||||||
Comment: dummyResult.Comment + conf.Comment,
|
Comment: sampleResult.Comment + conf.Comment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Dummy) Run(results []stage.ExecutorResult, confAny any) (
|
func (*Sample) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
[]stage.ParserResult, bool, error,
|
[]stage.ParserResult, bool, error,
|
||||||
) {
|
) {
|
||||||
conf, err := stage.DecodeConf[Conf](confAny)
|
conf, err := stage.DecodeConf[Conf](confAny)
|
|
@ -1,4 +1,4 @@
|
||||||
package dummy
|
package sample
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -19,10 +19,10 @@ func Run(conf Conf) (res Result, err error) {
|
||||||
// the sandbox, the logs will not show in drone output directly.
|
// the sandbox, the logs will not show in drone output directly.
|
||||||
// If there are more kinds of errors need to be handled separately, add
|
// If there are more kinds of errors need to be handled separately, add
|
||||||
// more fields in the Result struct, don't mess everything up in Stderr.
|
// more fields in the Result struct, don't mess everything up in Stderr.
|
||||||
err = fmt.Errorf("dummy negative score: %d", conf.Score)
|
err = fmt.Errorf("sample negative score: %d", conf.Score)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
res.Score = conf.Score
|
res.Score = conf.Score
|
||||||
res.Comment = "dummy comment"
|
res.Comment = "sample comment"
|
||||||
return
|
return
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user