aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAria Shrimpton <me@aria.rip>2024-01-29 23:56:24 +0000
committerAria Shrimpton <me@aria.rip>2024-01-29 23:56:24 +0000
commit2559da1fbf3a7e78ae105108a314cad106237368 (patch)
treeb71010464836c211b9104a6666187cf296f407a9
parentd976cddbea716de16e8b949415aa75922662a882 (diff)
run-all-tests job
-rw-r--r--.gitlab-ci.yml4
-rw-r--r--Justfile3
-rw-r--r--nix/candelabra.nix5
-rw-r--r--nix/racket-env.nix2
-rw-r--r--src/Justfile38
5 files changed, 36 insertions, 16 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9971c38..75c68e9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,5 +13,5 @@ run-tests:
- chmod 700 ~/.ssh
- cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
script:
- - ssh $SSH_LOCATION 'cd /opt/candelabra && git pull && nixos-rebuild switch --flake .#default'
- - ssh $SSH_LOCATION 'cd /opt/candelabra && just run-all-tests'
+ - ssh $SSH_LOCATION 'cd /opt/candelabra && git pull && nixos-rebuild switch --fast --flake .#default'
+ - ssh $SSH_LOCATION 'cd /opt/candelabra/src && just run-all-tests'
diff --git a/Justfile b/Justfile
index 3b9db86..b31b550 100644
--- a/Justfile
+++ b/Justfile
@@ -14,6 +14,3 @@ thesis-watch:
alias tc := thesis-clean
thesis-clean:
cd thesis/; latexmk -c
-
-run-all-tests:
- echo "TODO: run the tests!!"
diff --git a/nix/candelabra.nix b/nix/candelabra.nix
index da0a51c..192bf1f 100644
--- a/nix/candelabra.nix
+++ b/nix/candelabra.nix
@@ -13,14 +13,14 @@ inputs @ {
src = craneLib.cleanCargoSource (craneLib.path ../src);
doCheck = false;
- propagatedBuildInputs = [(pkgs.callPackage ./racket-env.nix inputs)];
+ propagatedBuildInputs = [];
cargoExtraArgs = "-p candelabra-cli";
};
in
pkgs.runCommand "candelabra" {} ''
. ${pkgs.makeWrapper}/nix-support/setup-hook
- mkdir -p $out/bin
+ mkdir -p $out/{bin,nix-support}
makeWrapper ${rustCrate}/bin/candelabra $out/bin/candelabra \
--set CANDELABRA_SRC_DIR ${pkgs.lib.sourceByRegex ../src [
".*crates"
@@ -28,4 +28,5 @@ in
".*crates/library.*"
".*crates/benchmarker.*"
]}
+ echo "${pkgs.callPackage ./racket-env.nix inputs} ${toolchain}" > $out/nix-support/propagated-build-inputs
''
diff --git a/nix/racket-env.nix b/nix/racket-env.nix
index 0577b97..d05a4f8 100644
--- a/nix/racket-env.nix
+++ b/nix/racket-env.nix
@@ -426,8 +426,8 @@ in
pkgs.stdenv.mkDerivation {
name = "racket-wrapped";
buildInputs = [pkgs.makeWrapper];
- phases = ["installPhase"];
propagatedBuildInputs = [pkgs.z3];
+ phases = ["installPhase" "fixupPhase"];
installPhase = ''
mkdir -p $out/bin
makeWrapper ${racket}/bin/racket $out/bin/racket \
diff --git a/src/Justfile b/src/Justfile
index 1a503ff..7c31771 100644
--- a/src/Justfile
+++ b/src/Justfile
@@ -1,11 +1,33 @@
-select PROJ:
- cargo run -- --manifest-path tests/Cargo.toml -p {{PROJ}} select
+candelabra := `which candelabra 2>/dev/null || echo ./target/debug/candelabra`
+target_dir := justfile_directory() / "target"
+tests_dir := justfile_directory() / "tests"
+tests_manifest := tests_dir / "Cargo.toml"
-compare PROJ:
- cargo run -- --manifest-path tests/Cargo.toml -p {{PROJ}} select --compare
+impls := "std::collections::BTreeSet primrose_library::LazySortedVec std::collections::LinkedList primrose_library::EagerUniqueVec std::collections::HashSet std::collections::BTreeMap std::collections::HashMap primrose_library::LazyUniqueVec primrose_library::EagerSortedVec std::vec::Vec"
+proj := "std::vec::Vec std::collections::LinkedList"
+export RUST_LOG := "debug"
-candidates PROJ:
- cargo run -- --manifest-path tests/Cargo.toml -p {{PROJ}} candidates
+run-all-tests:
+ which candelabra 2>/dev/null || cargo build
+ rm -fr {{target_dir / "candelabra"}}
+ echo "Candelabra Path: {{candelabra}}"
-cost-model IMPL:
- cargo run -- cost-model {{IMPL}}
+ @just section-start cost-models
+ @IMPLS=`cargo run -- list-library 2>&1 | cut -d ']' -f 2 | grep ::`; for impl in $IMPLS; do just cost-model $impl; done
+ @just section-end cost-models
+
+ @just section-start comparisons
+ cd tests/ && for i in $(ls -d */); do [ "${i%%/}" == "target" ] || just compare ${i%%/}; done
+ @just section-end comparisons
+
+cost-model impl: (section-start ("cost-model-" + impl)) && (section-end ("cost-model-" + impl))
+ {{candelabra}} cost-model {{impl}}
+
+compare proj: (section-start ("compare-" + proj)) && (section-end ("compare-" + proj))
+ {{candelabra}} --manifest-path {{tests_manifest}} -p {{proj}} select --compare
+
+@section-start NAME:
+ echo -e "\e[0Ksection_start:`date +%s`:{{NAME}}\r\e[0K{{NAME}}"
+
+@section-end NAME:
+ echo -e "\e[0Ksection_end:`date +%s`:{{NAME}}\r\e[0K"