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

Commits:

3 changed files:

Changes:

  • testsuite/tests/interface-stability/.gitignore
    1
    +download-base-exports

  • testsuite/tests/interface-stability/README.mkd
    1 1
     # Interface stability testing
    
    2 2
     
    
    3
    -The tests in this directory verify that the interfaces of exposed by GHC's
    
    3
    +The tests in this directory verify that the interfaces exposed by GHC's
    
    4 4
     core libraries do not inadvertently change. They use the `utils/dump-decls`
    
    5 5
     utility to dump all exported declarations of all exposed modules for the
    
    6 6
     following packages:
    
    ... ... @@ -27,7 +27,9 @@ The `base-exports` test in particular has rather platform-dependent output.
    27 27
     Consequently, updating its output can be a bit tricky. There are two ways by
    
    28 28
     which one can do this:
    
    29 29
     
    
    30
    - * Extrapolation: The various platforms' `base-exports.stdout` files are
    
    30
    +#### Extrapolation
    
    31
    +
    
    32
    +The various platforms' `base-exports.stdout` files are
    
    31 33
        similar enough that one can often apply the same patch of one file to the
    
    32 34
        others.  For instance:
    
    33 35
        ```
    
    ... ... @@ -40,8 +42,44 @@ which one can do this:
    40 42
        In the case of conflicts, increasing the fuzz factor (using `-F`) can be
    
    41 43
        quite effective.
    
    42 44
     
    
    43
    - * Using CI: Each CI job produces a tarball, `unexpected-test-output.tar.gz`,
    
    45
    +#### Using CI
    
    46
    +
    
    47
    +Each CI job produces a tarball, `unexpected-test-output.tar.gz`,
    
    44 48
        which contains the output produced by the job's failing tests. Simply
    
    45
    -   download this tarball and extracting the appropriate `base-exports.stdout-*`
    
    49
    +   download this tarball and extract the appropriate `base-exports.stdout-*`
    
    46 50
        files into this directory.
    
    47 51
     
    
    52
    +Doing this by hand is of course very annoying. To make things faster, use the script in this folder called `download.base-exports.sh` :
    
    53
    +
    
    54
    +* Running for the first time
    
    55
    +    1. Find the URL for downloading unexpected-test-output.tar.gz. To do so
    
    56
    +        * Go to the CI job page you want to download
    
    57
    +        * Click on "Browse"
    
    58
    +        * Find unexpected-test-output.tar.gz
    
    59
    +        * Right-click the download link then "Copy link" (Firefox)
    
    60
    +    2. The URL should look like this :
    
    61
    +        `https://gitlab.haskell.org/ghc/ghc/-/jobs/2503744/artifacts/file/unexpected-test-output.tar.gz`
    
    62
    +        * the prefix is   : `https://gitlab.haskell.org/ghc/ghc/-/jobs/`
    
    63
    +        * the job ID is   : `2503744`
    
    64
    +        * and the suffix  : `/artifacts/file/unexpected-test-output.tar.gz`
    
    65
    +    3. The script prompts you with URL prefix and suffix.
    
    66
    +    4. It will save a file to remember this, so you only need to do this once.
    
    67
    +    5. If you need to change the URL, just edit the file `download-base-exports/url-unexpected-test-output` directly.
    
    68
    +
    
    69
    +* Downloading the artifacts
    
    70
    +    1. Find all the job IDs you want to download. For this, just go to the jobs
    
    71
    +       page `https://gitlab.haskell.org/<YOUR-FORK>/ghc/-/jobs`
    
    72
    +    2. Make sure you get all the artifacts. You need 3 of them.
    
    73
    +       To get all 3 CI jobs, the label `javascript` must be on the MR.
    
    74
    +       If you don't have the rights for adding these labels, ask.
    
    75
    +          1. The `x86` CI job for darwin or linux : `base-exports.stdout`
    
    76
    +          2. The `windows` job : `base-exports.stdout-mingw32`
    
    77
    +          3. The `javascript` CI job :
    
    78
    +                          `base-exports.stdout-javascript-unknown-ghcjs`
    
    79
    +    3. Run the script with all the job IDs :
    
    80
    +       `./download-base-exports.sh 2502789 2502792 2502793`
    
    81
    +
    
    82
    +       Using a range downloads more artifacts than necessary, but is a
    
    83
    +       no-brainer:
    
    84
    +
    
    85
    +       `./download-base-exports.sh {2502789..2502795}`

  • testsuite/tests/interface-stability/download-base-exports.sh
    1
    +#!/usr/bin/env bash
    
    2
    +
    
    3
    +# See the README file in this folder for usage
    
    4
    +
    
    5
    +jobIDs=("$@")
    
    6
    +
    
    7
    +BASE_DIR_NAME=download-base-exports
    
    8
    +DL_DIR_NAME=dl
    
    9
    +BASE_DIR="$(dirname "$0")/$BASE_DIR_NAME"
    
    10
    +DL_DIR=$BASE_DIR/$DL_DIR_NAME
    
    11
    +URL_FILE="$BASE_DIR/url-unexpected-test-output"
    
    12
    +
    
    13
    +DEFAULT_PREFIX="https://gitlab.haskell.org/ghc/ghc/-/jobs/"
    
    14
    +DEFAULT_POSTFIX="/artifacts/raw/unexpected-test-output.tar.gz"
    
    15
    +
    
    16
    +mkdir -p "$BASE_DIR"
    
    17
    +
    
    18
    +# URL configuration for finding unexpected-test-output.tar.gz
    
    19
    +
    
    20
    +if [[ ! -f "$URL_FILE" ]]; then
    
    21
    +    echo "No URL for unexpected-test-output.tar.gz was found"
    
    22
    +
    
    23
    +    read -p "Enter job URL prefix [${DEFAULT_PREFIX}]: " inputPrefix
    
    24
    +    read -p "Enter job URL postfix [${DEFAULT_POSTFIX}]: " inputPostfix
    
    25
    +
    
    26
    +    urlPrefix="${inputPrefix:-$DEFAULT_PREFIX}"
    
    27
    +    urlPostfix="${inputPostfix:-$DEFAULT_POSTFIX}"
    
    28
    +
    
    29
    +    {
    
    30
    +        echo "urlPrefix=$urlPrefix"
    
    31
    +        echo "urlPostfix=$urlPostfix"
    
    32
    +    } > "$URL_FILE"
    
    33
    +else
    
    34
    +    source "$URL_FILE"
    
    35
    +fi
    
    36
    +
    
    37
    +mkdir -p $DL_DIR
    
    38
    +
    
    39
    +echo "urlPrefix: $urlPrefix"
    
    40
    +echo "jobIDs: $jobIDs"
    
    41
    +echo "urlPostfix: $urlPostfix"
    
    42
    +echo ""
    
    43
    +echo "Downloading unexpected-test-output.tar.gz for each job ..."
    
    44
    +
    
    45
    +# Download and copy base-exports*  files
    
    46
    +
    
    47
    +for jobID  in "${jobIDs[@]}"; do
    
    48
    +  unexpectedOutputUrl="$urlPrefix$jobID$urlPostfix"
    
    49
    +
    
    50
    +  wget -O "$DL_DIR/job$jobID.tar.gz" $unexpectedOutputUrl
    
    51
    +
    
    52
    +  mkdir -p "$DL_DIR/job$jobID"
    
    53
    +  tar -xzf "$DL_DIR/job$jobID.tar.gz" -C "$DL_DIR/job$jobID"
    
    54
    +  cp "$DL_DIR/job$jobID"/unexpected-test-output/testsuite/tests/interface-stability/base-exports* "$BASE_DIR/.."
    
    55
    +done