[Git][ghc/ghc][master] 2 commits: ci.sh: Factor out common utilities

Marge Bot gitlab at gitlab.haskell.org
Sat Sep 26 01:11:01 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
dd664031 by Ben Gamari at 2020-09-25T21:10:56-04:00
ci.sh: Factor out common utilities

- - - - -
5b78e865 by Ben Gamari at 2020-09-25T21:10:56-04:00
ci: Add ad-hoc performance testing rule

- - - - -


3 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- + .gitlab/common.sh


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -1095,6 +1095,41 @@ perf-nofib:
     paths:
       - nofib.log
 
+############################################################
+# Ad-hoc performance testing
+############################################################
+
+perf:
+  stage: testing
+  dependencies:
+    - validate-x86_64-linux-deb9-dwarf
+  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
+  rules:
+    - if: $CI_MERGE_REQUEST_ID
+    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
+  tags:
+    - x86_64-linux-perf
+  script:
+    - root=$(pwd)/ghc
+    - |
+      mkdir tmp
+      tar -xf ghc-x86_64-deb9-linux-dwarf.tar.xz -C tmp
+      pushd tmp/ghc-*/
+      ./configure --prefix=$root
+      make install
+      popd
+      rm -Rf tmp
+    - export BOOT_HC=$(which ghc)
+    - export HC=$root/bin/ghc
+    - .gitlab/ci.sh perf_test
+  artifacts:
+    expire_in: 12 week
+    when: always
+    paths:
+      - out
+
+
 ############################################################
 # Documentation deployment via GitLab Pages
 ############################################################


=====================================
.gitlab/ci.sh
=====================================
@@ -10,54 +10,12 @@ hackage_index_state="2020-09-14T19:30:43Z"
 MIN_HAPPY_VERSION="1.20"
 MIN_ALEX_VERSION="3.2"
 
-# Colors
-BLACK="0;30"
-GRAY="1;30"
-RED="0;31"
-LT_RED="1;31"
-BROWN="0;33"
-LT_BROWN="1;33"
-GREEN="0;32"
-LT_GREEN="1;32"
-BLUE="0;34"
-LT_BLUE="1;34"
-PURPLE="0;35"
-LT_PURPLE="1;35"
-CYAN="0;36"
-LT_CYAN="1;36"
-WHITE="1;37"
-LT_GRAY="0;37"
-
-# GitLab Pipelines log section delimiters
-# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
-start_section() {
-  name="$1"
-  echo -e "section_start:$(date +%s):$name\015\033[0K"
-}
-
-end_section() {
-  name="$1"
-  echo -e "section_end:$(date +%s):$name\015\033[0K"
-}
-
-echo_color() {
-  local color="$1"
-  local msg="$2"
-  echo -e "\033[${color}m${msg}\033[0m"
-}
-
-error() { echo_color "${RED}" "$1"; }
-warn() { echo_color "${LT_BROWN}" "$1"; }
-info() { echo_color "${LT_BLUE}" "$1"; }
-
-fail() { error "error: $1"; exit 1; }
-
-function run() {
-  info "Running $*..."
-  "$@" || ( error "$* failed"; return 1; )
-}
-
 TOP="$(pwd)"
+if [ ! -d "$TOP/.gitlab" ]; then
+  echo "This script expects to be run from the root of a ghc checkout"
+fi
+
+source $TOP/.gitlab/common.sh
 
 function setup_locale() {
   # Musl doesn't provide locale support at all...
@@ -437,6 +395,34 @@ function test_hadrian() {
     --test-compiler="$TOP"/_build/install/bin/ghc
 }
 
+function cabal_test() {
+  if [ -z "$OUT" ]; then
+    fail "OUT not set"
+  fi
+
+  start_section "Cabal test: $OUT"
+  mkdir -p "$OUT"
+  run "$HC" \
+    -hidir tmp -odir tmp -fforce-recomp \
+    -ddump-to-file -dumpdir "$OUT/dumps" -ddump-timings \
+    +RTS --machine-readable "-t$OUT/rts.log" -RTS \
+    -package mtl -ilibraries/Cabal/Cabal libraries/Cabal/Cabal/Setup.hs \
+    $@
+  rm -Rf tmp
+  end_section "Cabal test: $OUT"
+}
+
+function run_perf_test() {
+  if [ -z "$HC" ]; then
+    fail "HC not set"
+  fi
+
+  mkdir -p out
+  OUT=out/Cabal-O0 cabal_test -O0
+  OUT=out/Cabal-O1 cabal_test -O1
+  OUT=out/Cabal-O2 cabal_test -O2
+}
+
 function clean() {
   rm -R tmp
   run "$MAKE" --quiet clean || true
@@ -507,6 +493,7 @@ case $1 in
     push_perf_notes
     exit $res ;;
   run_hadrian) run_hadrian $@ ;;
+  perf_test) run_perf_test ;;
   clean) clean ;;
   shell) shell $@ ;;
   *) fail "unknown mode $1" ;;


=====================================
.gitlab/common.sh
=====================================
@@ -0,0 +1,50 @@
+# Common bash utilities
+# ----------------------
+
+# Colors
+BLACK="0;30"
+GRAY="1;30"
+RED="0;31"
+LT_RED="1;31"
+BROWN="0;33"
+LT_BROWN="1;33"
+GREEN="0;32"
+LT_GREEN="1;32"
+BLUE="0;34"
+LT_BLUE="1;34"
+PURPLE="0;35"
+LT_PURPLE="1;35"
+CYAN="0;36"
+LT_CYAN="1;36"
+WHITE="1;37"
+LT_GRAY="0;37"
+
+# GitLab Pipelines log section delimiters
+# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
+start_section() {
+  name="$1"
+  echo -e "section_start:$(date +%s):$name\015\033[0K"
+}
+
+end_section() {
+  name="$1"
+  echo -e "section_end:$(date +%s):$name\015\033[0K"
+}
+
+echo_color() {
+  local color="$1"
+  local msg="$2"
+  echo -e "\033[${color}m${msg}\033[0m"
+}
+
+error() { echo_color "${RED}" "$1"; }
+warn() { echo_color "${LT_BROWN}" "$1"; }
+info() { echo_color "${LT_BLUE}" "$1"; }
+
+fail() { error "error: $1"; exit 1; }
+
+function run() {
+  info "Running $*..."
+  "$@" || ( error "$* failed"; return 1; )
+}
+



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5b72718953c289b6827e877e14d9f0f3f5c64267...5b78e8658c3f5042967cbe9d30a5a630946c4fd7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5b72718953c289b6827e877e14d9f0f3f5c64267...5b78e8658c3f5042967cbe9d30a5a630946c4fd7
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200925/36581e9b/attachment-0001.html>


More information about the ghc-commits mailing list