Skip to content

Commit

Permalink
Figure out how to properly use nix-env + minors
Browse files Browse the repository at this point in the history
  • Loading branch information
K-dizzled committed Apr 17, 2024
1 parent 91cfd7a commit f8330f5
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ src/test/resources/coqProj/.vscode
**/*.aux
src/test/resources/coqProj/.Makefile.coq.d
src/test/resources/coqProj/Makefile.coq
src/test/resources/coqProj/Makefile.coq.conf
src/test/resources/coqProj/Makefile.coq.conf

# Ignore the generated build files in datatests inside benchmarks
src/test/benchmark/dataset/**/result
src/test/benchmark/dataset/**/.vscode/
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[submodule "src/test/benchmark/dataset/imm"]
path = src/test/benchmark/dataset/imm
url = https://github.com/weakmemory/imm.git
brach = coq819
ignore = dirty
3 changes: 2 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
logs/**
_opam/**
_opam/**
./out/test/**
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,37 @@ Each of these settings are modified in `settings.json` and contain an array of m

- Add benchmarking options for various models: soon.

## Benchmark

To run benchmarks on some project, apart from installing and building CoqPilot manually as described above, you will need to download the necessary projects that are used as datasets for the benchmarks. These projects are added as submodules to the repository. To download them, run the following commands:
```bash
git submodule init
git submodule update
```
After that, you need to build the projects. And be careful, the actively maintained way to build this projects is `nix`. Moreover, when adding your own projects, make sure that they are built using `coq-8.19.0`.

First things first, the process of running the benchmark is not perfectly automated yet. We are working on it. For now, one project (one unit containing nix environment) shall be ran at a time. Let's say you are going to run the benchmark on the `imm` project. You will have to do the following:

1. Install nix, as specified in the [here](https://nixos.org/download.html).

2. Install needed caches:
```bash
nix-env -iA nixpkgs.cachix && cachix use coq && cachix use coq-community && cachix use math-comp
cachix use weakmemory
```

3. Go to the `imm` subdirectory, apply the nix environment (without it the project will NOT build) and build the project:
```bash
cd src/test/benchmark/dataset/imm
nix-shell
nix-build
```
4. Return to the project root not exiting the nix-shell. Run the benchmark:
```bash
cd ../../../../..
npm run benchmark
```

## Release Notes

Release notes could be found in the [CHANGELOG.md](https://github.com/JetBrains-Research/coqpilot/blob/refactor/CHANGELOG.md) file.
2 changes: 2 additions & 0 deletions src/coqLsp/coqLspConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Uri } from "vscode";
import {
LanguageClientOptions,
RevealOutputChannelOn,
Trace,
} from "vscode-languageclient";
import { LanguageClient, ServerOptions } from "vscode-languageclient/node";

Expand Down Expand Up @@ -58,6 +59,7 @@ export class CoqLspConnector extends LanguageClient {
}

override async start(): Promise<void> {
super.setTrace(Trace.Verbose);
await super
.start()
.then(this.logStatusUpdate.bind(this, "started"))
Expand Down
49 changes: 49 additions & 0 deletions src/logging/outputChannelEmulator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { appendFileSync, existsSync, writeFileSync } from "fs";
import { OutputChannel, ViewColumn } from "vscode";

export class OutputChannelEmulator implements OutputChannel {
name: string;

constructor(
private logFilePath: string,
name: string = "OutputChannelEmulator"
) {
this.name = name;
if (!existsSync(this.logFilePath)) {
writeFileSync(this.logFilePath, "");
}
}

append(value: string): void {
appendFileSync(this.logFilePath, value);
}

appendLine(value: string): void {
appendFileSync(this.logFilePath, value + "\n");
}

replace(value: string): void {
writeFileSync(this.logFilePath, value);
}

clear(): void {
writeFileSync(this.logFilePath, "");
}

show(preserveFocus?: boolean | undefined): void;

show(
column?: ViewColumn | undefined,
preserveFocus?: boolean | undefined
): void;

show(_column?: unknown, _preserveFocus?: unknown): void {
throw new Error("Method not implemented.");
}

hide(): void {
throw new Error("Method not implemented.");
}

dispose(): void {}
}
1 change: 1 addition & 0 deletions src/test/benchmark/dataset/imm
Submodule imm added at 14025d
14 changes: 13 additions & 1 deletion src/test/benchmark/runBenchmark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,19 @@ const mixedAutoBenchmark: Benchmark = {
timeoutMinutes: 1,
};

const benchmarks: Benchmark[] = [simpleAutoBenchmark, mixedAutoBenchmark];
const immBenchmark: Benchmark = {
name: "Complete imm with auto",
items: [new DatasetItem("imm/src/basic/Events.v", "imm")],
modelsParams: onlyAutoModelsParams,
requireAllAdmitsCompleted: false,
timeoutMinutes: 60,
};

const benchmarks: Benchmark[] = [
simpleAutoBenchmark,
mixedAutoBenchmark,
immBenchmark,
];

suite("Benchmark", () => {
const benchmarkDir = getBenchmarkDir();
Expand Down

0 comments on commit f8330f5

Please sign in to comment.