Skip to content

Commit

Permalink
groot/{internal/rtests,riofs}: better ACliC handling
Browse files Browse the repository at this point in the history
This CL enables an optional use of ACliC through RunCxxROOT.
When a '+' is appended to the name of the function to run, ACliC will be
enabled.

Ex:
 out, err := rtests.RunCxxROOT("gentree+", []byte(class+script), *root, *split)
  • Loading branch information
sbinet committed Feb 23, 2022
1 parent e453fa7 commit ca83c45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion groot/internal/rtests/rtests.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ var (
// RunCxxROOT creates a temporary file named '<fct>.C' from the provided C++ code and
// executes it via ROOT C++.
// RunCxxROOT returns the combined stdout/stderr output and an error, if any.
// If 'fct' ends with a '+', RunCxxROOT will run the macro through ACliC.
func RunCxxROOT(fct string, code []byte, args ...interface{}) ([]byte, error) {
aclic := ""
if strings.HasSuffix(fct, "+") {
aclic = "+"
}
fct = strings.TrimRight(fct, "+")
tmp, err := os.MkdirTemp("", "groot-rtests-")
if err != nil {
return nil, fmt.Errorf("could not create tmpdir: %w", err)
Expand All @@ -55,7 +61,7 @@ func RunCxxROOT(fct string, code []byte, args ...interface{}) ([]byte, error) {
}

o := new(strings.Builder)
fmt.Fprintf(o, "%s+(", fname)
fmt.Fprintf(o, "%s%s(", fname, aclic)
for i, arg := range args {
format := ""
if i > 0 {
Expand Down
2 changes: 1 addition & 1 deletion groot/riofs/gendata/gen-tdatime.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
func main() {
flag.Parse()

out, err := rtests.RunCxxROOT("gentree", []byte(class+script), *root, *split)
out, err := rtests.RunCxxROOT("gentree+", []byte(class+script), *root, *split)
if err != nil {
log.Fatalf("could not run ROOT macro:\noutput:\n%v\nerror: %+v", string(out), err)
}
Expand Down

0 comments on commit ca83c45

Please sign in to comment.