Skip to content
Merged
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
89 changes: 1 addition & 88 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,94 +21,7 @@ preferences and working conventions. This file is gitignored and optional.

## Build Commands

### Basic Build
```bash
# Configure (creates out-of-source build directory)
cmake -B build

# Build everything
cmake --build build

# Install (default: /usr/local)
cmake --install build
```

### Common Build Presets
```bash
# Development build with compile_commands.json for IDE support
cmake --preset dev
cmake --build build-dev

# Release build
cmake --preset release
cmake --build build-release

# Build with autests enabled
cmake --preset ci-fedora-autest
cmake --build build-autest
```

### Useful Build Options
```bash
# Specify dependency locations (like autotools --with-*)
cmake -B build -Djemalloc_ROOT=/opt/jemalloc -DOPENSSL_ROOT_DIR=/opt/boringssl

# Build specific targets
cmake --build build -t traffic_server
cmake --build build -t format # Format code before committing
```

### Key CMake Options
- `BUILD_EXPERIMENTAL_PLUGINS=ON` - Enable experimental plugins
- `ENABLE_QUICHE=ON` - QUIC/HTTP3 support
- `ENABLE_CRIPTS=ON` - Cripts scripting API
- `BUILD_REGRESSION_TESTING=ON` - Enable test suite
- `ENABLE_ASAN=ON` - Configure ASan instrumentation

## Testing

### Unit Tests (Catch2)
Built automatically with the project. Run via ctest:
```bash
ctest --test-dir build -j4
```

### Running a Single Unit Test
Unit tests are built into executables. Find the test binary and run it directly:
```bash
# Unit tests are typically in build/src/<component>/
./build/src/tscore/test_tscore
```

### End-to-End Tests (AuTest)

**Enable autests during configuration:**
```bash
cmake -B build -DENABLE_AUTEST=ON
cmake --build build
cmake --install build
```

**Run all autests:**
```bash
cmake --build build -t autest
```

**Run specific test(s):**
```bash
cd build/tests
pipenv install # First time only
./autest.sh --sandbox /tmp/sbcursor --clean=none -f <test_name_without_test_py>
```

For example, to run `cache-auth.test.py`:
```bash
./autest.sh --sandbox /tmp/sbcursor --clean=none -f cache-auth
```

Most end-to-end test coverage is in `tests/gold_tests/`. The CI system uses the
Docker image `ci.trafficserver.apache.org/ats/fedora:43` (Fedora version updated
regularly).
Use the ats-build skill for building, testing, and formatting, unless instructed otherwise.

### Writing Autests

Expand Down
81 changes: 81 additions & 0 deletions .claude/skills/ats-build/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: ats-build
Comment thread
JosiahWI marked this conversation as resolved.
description: Basic skills; formatting, compiling, testing, installing.
---

## Build Process

1. Which `cmake --list-presets`?
* Need HTTP3? `ci-fedora-quiche`
* Not sure? Ask.
2. No build directory yet? Configure one.
3. Which target?
4. Execute.

## Reference

### Configure Development Build

```bash
cmake --preset <name> [-B <build_dir>] -DENABLE_AUTEST=ON
```

### Build Code Target

```bash
cmake --build <build_dir> --target <executable_or_library_target>
```

### Run Unit Test

```bash
ctest --test-dir <build_dir> [-R <filter>]
```

### Format

```bash
cmake --build <build_dir> --target format
```

### Run AuTest

Options correct? Check:

```bash
grep "^AUTEST_OPTIONS" <build_dir>/CMakeCache.txt
```

Correct? Run:

```bash
cmake --build <build_dir> --target autest
```

#### Example: Configure Build for Specific AuTest

```bash
cmake -B <build_dir> -DAUTEST_OPTIONS="-f <autest_name>"
```

### Install

Install location OK? Check:

```bash
grep "^CMAKE_INSTALL_PREFIX" <build_dir>/CMakeCache.txt
```

Correct? Run:

```bash
cmake --install <build_dir>
```

## Key CMake Options

- `BUILD_EXPERIMENTAL_PLUGINS=ON` - Enable experimental plugins
- `ENABLE_QUICHE=ON` - QUIC/HTTP3 support
- `ENABLE_CRIPTS=ON` - Cripts scripting API
- `BUILD_REGRESSION_TESTING=ON` - Enable test suite
- `ENABLE_ASAN=ON` - Configure ASan instrumentation