Skip to content

Commit

Permalink
Tease apart COARSE_DOCKER/COARSE_NIX and STACK_DOCKER/STACK_NIX, but …
Browse files Browse the repository at this point in the history
…all need work to bring them back.
  • Loading branch information
rrnewton committed Jan 27, 2019
1 parent 3419cbf commit cc34125
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 34 deletions.
12 changes: 8 additions & 4 deletions .jenkins_script.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

# The major environment variables this uses are:
# * COARSE_DOCKER=1 : coarse-grained, "build/run everything inside Docker"
# * COARSE_NIX=1 : same for Nix

set -xe

echo "Running on machine: "`hostname -a || echo env says $HOSTNAME`
Expand All @@ -12,10 +16,10 @@ echo "Git commit depth: "

top=`pwd`

# This testing mode assumes that nix/docker integration is OFF by default:
# This testing mode assumes that stack's own nix/docker integration is OFF by default:
export STACKARGS="--no-system-ghc"

if [ "$DOCKER" == "1" ]; then
if [ "$COARSE_DOCKER" == "1" ]; then
# Make bintree-bench image:
cd $top/BintreeBench
make docker
Expand All @@ -24,10 +28,10 @@ if [ "$DOCKER" == "1" ]; then
cd $top/
docker build -t tree-velocity .

elif [ "$USE_NIX" == "1" ]; then
elif [ "$COARSE_NIX" == "1" ]; then

# Here by default we use a pinned version of the software ecosystem:
nix-shell --pure --command "USE_NIX=1 ./run_all_tests.sh $@"
nix-shell --pure --command "COARSE_NIX=1 ./run_all_tests.sh $@"

else
# HACK to get Jenkins to use proper Racket and GCC versions
Expand Down
2 changes: 1 addition & 1 deletion .nix_default_environment.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/NixOS/nixpkgs-channels/archive/0f73fef53a97ff68205715d6ab6c0362db95b32f.tar.gz
https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sudo: required

# Do not choose a language; we provide our own build tools.
language: generic
# language: nix

# Caching so the next build will be fast too.
cache:
Expand All @@ -25,14 +26,14 @@ addons:
# Docker code
env:
-
- DOCKER=1
- USE_NIX=1
- STACK_DOCKER=1
# - STACK_NIX=1

# Temporary:
matrix:
allow_failures:
- env: DOCKER=1
- env: USE_NIX=1
- env: STACK_DOCKER=1
# - env: STACK_NIX=1

install:
# Download and unpack the stack executable
Expand Down
15 changes: 10 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
pipeline {
// This is designed to run on Cutter @ IU
agent {
label 'slurm'
}
// agent {
// label 'slurm'
// }

triggers {
// Try to create a webhook:
pollSCM('')
}

environment {
// COARSE_DOCKER='1'
// COARSE_NIX='1'
}

stages {
stage('Build') {
steps {
sh 'srun -N1 -t 1:00:00 --exclusive "./.jenkins_script.sh"'
// sh './.jenkins_script.sh'
// sh 'srun -N1 -t 1:00:00 --exclusive "./.jenkins_script.sh"'
sh './.jenkins_script.sh'
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ all: racket subst
deps:
cd deps/sexpr-1.3 && ./configure && $(MAKE)

subst:
# RRN: This makefile is gone. Was it ever there?
# cd ASTBenchmarks/substitution && $(MAKE)

racket: gibbon-lang

SANDBOX=.racket_sandbox
Expand All @@ -29,6 +25,7 @@ gibbon-lang: $(SANDBOX)
$(SANDBOX):
mkdir -p $@

# -------------------------- NIX ----------------------------------
# Bring up a shell using a fixed, known-good software image.
# - 51a83266d164195698f04468d90d2c6238ed3491 is a snapshot of nixos-17.03 channel on [2017.08.16]
# - 09b9f7e7c496813f3ecd01c39a976ae3637e41e6 is a snapshot of nixos-17.03 on [2017.10.03]
Expand All @@ -46,6 +43,8 @@ pure:
head: head-shell
head-shell:
nix-shell --arg pkgs 'import <nixpkgs> {}'
# -------------------------- /NIX ----------------------------------


# Aggressive clean of the working copy:
clean:
Expand Down
19 changes: 17 additions & 2 deletions run_all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,22 @@ racket $top/ASTBenchmarks/kdTree-BenchMark/racket/traversal.gib

STK="stack --allow-different-user"

if [ "$USE_NIX" == "1" ]; then
if [ "$STACK_DOCKER" == "1" ]; then
if [ "$COARSE_DOCKER" == "1" ]; then
echo "ERROR: cannot use stack --docker when already running in COARSE_DOCKER=1"
exit 1
fi
STK+=" --docker "

elif [ "$STACK_NIX" == "1" ]; then
if [ "$COARSE_NIX" == "1" ]; then
echo "ERROR: should not use stack --nix when already running in COARSE_NIX=1"
exit 1
fi
STK+=" --nix "
fi

if [ "$COARSE_NIX" == "1" ]; then
STK+=" --system-ghc "
else
STK+=" --install-ghc "
Expand All @@ -116,7 +131,7 @@ fi
echo " Gibbon Compiler (2/2): compiler test suite"
echo "--------------------------------------------"

# Turning of -j for now [2016.11.06]
# Turning off -j for now [2016.11.06]
cd $top/gibbon-compiler
# make answers
$STK exec test-gibbon-examples -- -v2
Expand Down
21 changes: 7 additions & 14 deletions set_env.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This file must be sourced with ". set_env.sh" or "source set_env.sh"
#
# Responds to env var DOCKER=1 when this script is sourced.

if ! [ -d ./gibbon-compiler ]; then
echo "Error: please source this handy set_env script from the directory that contains it.";
Expand All @@ -10,15 +8,11 @@ fi
export GIBBONDIR=`pwd`
export PLTADDONDIR=$GIBBONDIR/.racket_sandbox/

if [ "$DOCKER" == "1" ]; then
STK="stack --docker "
else
STK="stack"
fi
STK="stack"
BUILD_ARGS=" --install-ghc build "

# A shortcut to make things easier:
function tc() {
function gib() {
cur=`pwd`
cd $GIBBONDIR/gibbon-compiler/
$STK $BUILD_ARGS
Expand All @@ -42,24 +36,23 @@ function tc() {
# WARNING: as of stack 1.2 you need to stack-clean between using
# tc/tcd. It is not smart enough to rebuild automatically and keep
# the build artifacts separate.
function tcd() {
BUILD_ARGS="$BUILD_ARGS --trace" tc $@
function gib_dbg() {
BUILD_ARGS="$BUILD_ARGS --trace" gib $@
}

# Nix version
function gibn() {
STK="stack --nix" tc $@
STK="stack --nix" gib $@
}

function gibd() {
# --docker-auto-pull isn't working:
(cd $GIBBONDIR/gibbon-compiler/ && stack docker pull 2> /dev/null) && \
STK="stack --docker " tc $@
STK="stack --docker " gib $@
}


# A quick verison that doesn't check for recompile.
function tcq() {
function gibq() {
cur=`pwd`
cd $GIBBONDIR/gibbon-compiler/
CMD=`stack exec -- which gibbon`
Expand Down

0 comments on commit cc34125

Please sign in to comment.