Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel AlexDaniel/bisect.p6 Secret
Last active Dec 22, 2018

Embed
What would you like to do?
#!/usr/bin/env perl6
# This is a short example on how you can use Whateverable locally to
# do some basic (commitable-like or bisectable-like) operations. Of
# course, as it uses pre-built rakudo, it will only run on 64-bit
# linux systems.
# ⚠ See some docs here https://github.com/perl6/whateverable/blob/master/lib/Whateverable/Bisection.pm6#L29
use Whateverable;
use Whateverable::Bisection;
use Whateverable::Builds;
use Whateverable::Config;
use Whateverable::Output;
use Whateverable::Running;
my $code-file = /tmp/quick-test.p6;
my $code = %*ENV<MVM_SPESH_NODELAY>=1; %*ENV<MVM_SPESH_BLOCKING>=1; run <perl6 -e>, ‘use Test; lives-ok { $*USER.gist; $*USER.WHAT.gist; }, ".WHAT on $*USER after using $*USER values lives";’;
my $old = 2018.10;
my $new = HEAD;
ensure-config ./config-default.json;
pull-cloned-repos; # pull rakudo and other stuff
my $old-full = to-full-commit 2018.10;
my $new-full = to-full-commit HEAD;
spurt $code-file, $code;
# ↓↓↓ Committable functionality ↓↓↓
#| Returns full commit sha
sub ensure-build($revision) {
my $full = to-full-commit $revision;
die No build for $revision unless build-exists $full;
return $full
}
dd run-snippet(ensure-build(2015.12), $code-file);
dd run-snippet(ensure-build(HEAD), $code-file);
dd run-snippet(ensure-build($old), $code-file);
dd run-snippet(ensure-build($new), $code-file);
# ↓↓↓ Bisectable functionality ↓↓↓
use File::Temp;
use File::Directory::Tree;
my $repo-cwd = tempdir :!unlink;
LEAVE rmtree $_ with $repo-cwd;
run :out(Nil), :err(Nil), <git clone>, $CONFIG<rakudo>, $repo-cwd;
my $bisect-start = get-output cwd => $repo-cwd, <git bisect start>;
my $bisect-old = get-output cwd => $repo-cwd, <git bisect old>, $old-full;
if $bisect-start<exit-code> ≠ 0 or $bisect-old<exit-code> ≠ 0 {
die Bisect failure
}
my $init-result = get-output cwd => $repo-cwd, <git bisect new>, $new-full;
my $bisect-result = run-bisect :$repo-cwd, :$code-file,
old-exit-code => 0; # CHANGE APPROPRIATELY
say First new commmit: , $bisect-result<first-new-commit>;
spurt bisect-log, $bisect-result<log>;
{
"repo-origin-rakudo" : "https://github.com/rakudo/rakudo.git",
"repo-current-rakudo-moar" : "./data/rakudo-moar",
"repo-origin-moarvm" : "https://github.com/MoarVM/MoarVM.git",
"repo-current-moarvm" : "./data/moarvm",
"archives-location" : "./data/builds",
"builds-location" : "/tmp/whateverable/",
"moarvm" : "./data/moarvm",
"rakudo-repo" : "https://github.com/rakudo/rakudo",
"mothership": "https://whateverable.6lang.org",
"github": {
"login": "",
"access_token": ""
},
"bisectable": {
"commit-link" : "https://github.com/rakudo/rakudo/commit",
"build-lock" : "./lock",
"trim-chars" : 2000
},
"default-stdin": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.