Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/benchmarks/performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ the on-disk and one-turn tables there came from other means, and `METHOD-REVIEW.
records what is and is not documented about them.

```bash
WORKDIR=$PWD docs/benchmarks/measure-cli.sh codeaf /tmp/bench-home/codeaf ./bin/codeaf chat
WORKDIR=$PWD docs/benchmarks/performance/measure-cli.sh codeaf /tmp/bench-home/codeaf ./bin/codeaf chat
```

Run it once per CLI, on the same machine, in the same working directory, within the same
Expand Down
40 changes: 40 additions & 0 deletions docs/benchmarks/performance/doc_paths_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package performance_test

import (
"os"
"path/filepath"
"regexp"
"runtime"
"testing"
)

var localScriptExample = regexp.MustCompile(`(?:docs|scripts)/[A-Za-z0-9_./-]+\.sh`)

func TestDocumentedScriptPathsResolve(t *testing.T) {
_, source, _, ok := runtime.Caller(0)
if !ok {
t.Fatal("could not locate test source")
}
root := filepath.Clean(filepath.Join(filepath.Dir(source), "..", "..", ".."))

for _, document := range []string{"README.md", "measure-cli.sh"} {
t.Run(document, func(t *testing.T) {
path := filepath.Join(root, "docs", "benchmarks", "performance", document)
contents, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
matches := localScriptExample.FindAllString(string(contents), -1)
if len(matches) == 0 {
t.Fatal("no local script examples found")
}

for _, example := range matches {
scriptPath := filepath.Join(root, filepath.FromSlash(example))
if _, err := os.Stat(scriptPath); err != nil {
t.Errorf("documented script %q does not resolve: %v", example, err)
}
}
})
}
}
2 changes: 1 addition & 1 deletion docs/benchmarks/performance/measure-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# From the root of a real repository:
#
# WORKDIR=$PWD docs/benchmarks/measure-cli.sh mine /tmp/bench-home/mine bin/mine chat
# WORKDIR=$PWD docs/benchmarks/performance/measure-cli.sh mine /tmp/bench-home/mine bin/mine chat
#
# <name> only labels the output, the tmux session and the run; nothing about the
# CLI is inferred from it. <home> is the profile the CLI runs under — an
Expand Down
15 changes: 15 additions & 0 deletions docs/changes/unreleased/1498-measure-cli-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
kind: fixed
title: benchmark examples use the script's current path
pr: 1498
# Optional. Which part of the repository this touches, so a reader can skip it.
# One or more of: build, chat, docs, engine, remote, resident
surface: [docs]
# Optional, and the reason this file exists. Every statement that WAS true and is
# not any more, written whole: what it was, and what it is now. A model reading
# this has to be able to check its own memory against it, so "branch names" is
# useless and "the trunk was chat-v3-task and no longer exists; work goes to dev"
# is the whole point. Leave the list empty if nothing anybody believed changed.
invalidates:
- "The examples pointed to `docs/benchmarks/measure-cli.sh`, which does not exist; use `docs/benchmarks/performance/measure-cli.sh`."
---