haskell-te: 4efb5632c3c6966a6718c46947392470ace7919d

     1: { bash, fail, inNixedDir, lib, mkBin, runCommand, tipBenchmarks, testData,
     2:   withDeps }:
     3: 
     4: with builtins;
     5: with lib;
     6: with rec {
     7:   genPkgHere = mkBin {
     8:     name  = "genPkgHere";
     9:     paths = [ bash tipBenchmarks.tools ];
    10:     script = ''
    11:       #!${bash}/bin/bash
    12:       OUT_DIR="$PWD" full_haskell_package
    13:     '';
    14:   };
    15: 
    16:   dirName = "haskellPkgGeneratedFromTip";
    17: 
    18:   tipToHaskellPkg = mkBin {
    19:     name   = "tipToHaskellPkg";
    20:     paths  = [ bash genPkgHere inNixedDir ];
    21:     script = ''
    22:       #!${bash}/bin/bash
    23:       inNixedDir genPkgHere "${dirName}"
    24:     '';
    25:   };
    26: 
    27:   checks = mapAttrs
    28:     (n: f: runCommand "test-tipToHaskellPkg-${n}"
    29:       {
    30:         inherit dirName f;
    31:         buildInputs = [ fail tipToHaskellPkg ];
    32:         SKIP_NIX    = "1";
    33:       }
    34:       ''
    35:         shopt -s nullglob
    36: 
    37:         command -v tipToHaskellPkg  || fail "No tipToHaskellPkg program"
    38: 
    39:         PRECRUFT=0
    40:         for X in ./*
    41:         do
    42:           PRECRUFT=$(( PRECRUFT + 1 ))
    43:         done
    44: 
    45:         D=$(tipToHaskellPkg < "$f") || fail "tipToHaskellPkg failed"
    46: 
    47:         [[ -n "$D" ]] || fail "Got no output"
    48:         Z=$(readlink -f "$D")
    49:         [[ -d "$Z" ]] || fail "Result '$D' ($Z) isn't directory"
    50: 
    51:         echo "Result is '$D'" 1>&2
    52: 
    53:         GOTCABAL=0
    54:         for CBL in "$D"/*.cabal
    55:         do
    56:           GOTCABAL=1
    57:         done
    58:         [[ "$GOTCABAL" -eq 1 ]] || fail "Found $GOTCABAL .cabal files"
    59: 
    60:         [[ -e "$PWD/${dirName}" ]] || fail "Didn't make '$PWD/${dirName}'"
    61:         WITHDIR=$(( PRECRUFT + 1 ))
    62: 
    63:         POSTCRUFT=0
    64:         for X in ./*
    65:         do
    66:           POSTCRUFT=$(( POSTCRUFT + 1 ))
    67:         done
    68:         [[ "$WITHDIR" -eq "$POSTCRUFT" ]] ||
    69:           fail "PWD has '$POSTCRUFT' entries; should have '$PRECRUFT' + 1"
    70: 
    71:         mkdir "$out"
    72:       '')
    73:     testData.tip;
    74: };
    75: 
    76: withDeps (attrValues checks) tipToHaskellPkg

Generated by git2html.