public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/microsoft/heads/main)] Build and test separation changes (#31)
@ 2021-04-16 20:36 Eugene Rozenfeld
  0 siblings, 0 replies; only message in thread
From: Eugene Rozenfeld @ 2021-04-16 20:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1aef839c6ebcf3c5244c1d970ae2c5144e3be25d

commit 1aef839c6ebcf3c5244c1d970ae2c5144e3be25d
Author: vitong <53017530+vitong@users.noreply.github.com>
Date:   Fri Jan 8 12:46:31 2021 -0800

    Build and test separation changes (#31)
    
    * Bring over workflow yamls and scripts to build and test gcc
    
    * Remove hack to find a particular build
    
    * Update configure script to work with new repo layout
    
    * update path to validate_failures.py
    
    * Add xfail file
    
    * Disable more failing ASAN tests
    
    * Update x86_64-pc-linux-gnu.xfail
    
    * Remove SHA paramter from DownloadBuildArtifact
    
    * Fix objdir paths
    
    * Update build-gcc with objdir path
    
    * Update objdir path when uploading artifact
    
    * Update build.yaml
    
    * Update gccWorkflow.py
    
    * Update build.yaml
    
    * Disable build-gcc.yaml
    
    * Test matrix
    
    * Add temp hack to get faster results
    
    * Add space for test-gcc.sh argument passing
    
    * Disable failfast
    
    * Add more gcc-c failures
    
    * Update x86_64-pc-linux-gnu.xfail
    
    * Temp remove hack
    
    * Update build.yaml
    
    * Move wait loop to a separate job so the test run doesn't exceed the 6h limit
    
    * Fix syntax erros
    
    * Fix missing logger def
    
    * Fix accesstoken
    
    * Debugging
    
    * More debug
    
    * Add hack to shortcut waiting on gcc build
    
    * Fix Reload method overloading
    
    * More debugigng
    
    * Don't print access token for future jobs
    
    * Zero out string in place with replace function
    
    * Fix printing
    
    * Remove shortcut hack
    
    * Remove commented out shortcut hack
    
    * Remove debugging prints
    
    * Address PR feedback
    
    * Fix error detection and reduce sleep times

Diff:
---
 .github/scripts/build-gcc.sh                       |  32 +-----
 .github/scripts/common.py                          |  22 ++++
 .github/scripts/config.py                          |  77 +++++++++++++
 .github/scripts/configure-gcc.sh                   |  22 ++++
 .github/scripts/downloadBuildArtifact.py           | 110 +++++++++++++++++++
 .github/scripts/gccWorkflow.py                     |  81 ++++++++++++++
 .github/scripts/globals.py                         |   6 ++
 .github/scripts/test-gcc.sh                        |  16 +++
 .github/workflows/build-gcc.yaml                   | 106 ------------------
 .github/workflows/build.yaml                       |  79 ++++++++++++++
 .github/workflows/test-gcc.yaml                    | 120 +++++++++++++++++++++
 .../testsuite-management/x86_64-pc-linux-gnu.xfail |  65 +++++++++++
 12 files changed, 602 insertions(+), 134 deletions(-)

diff --git a/.github/scripts/build-gcc.sh b/.github/scripts/build-gcc.sh
index fa65299d233..66cb914e8c4 100644
--- a/.github/scripts/build-gcc.sh
+++ b/.github/scripts/build-gcc.sh
@@ -1,44 +1,20 @@
-sudo apt update
 
-# Install gcc 7 and g++ 7
-sudo apt-get install gcc-7 g++-7 g++-7-multilib libstdc++-7-doc  binutils-doc build-essential cpp-doc gcc-7-doc libstdc++6-7-dbg lib32stdc++6-7-dbg libx32stdc++6-7-dbg make autoconf automake libtool flex bison gdb gcc-doc libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc python
-
-# Redirect gcc and g++ to the installed versions
-sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 
-sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60
-
-# Redirect cc and c++ to the installed gcc and g++ versions:		
-sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
-sudo update-alternatives --set cc /usr/bin/gcc
-		
-sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
-sudo update-alternatives --set c++ /usr/bin/g++
-
-sudo apt install -y texinfo
-sudo apt-get install -y dejagnu
-./contrib/download_prerequisites
-
-cd ..
-mkdir objdir
-cd objdir
+cd ../objdir
 $PWD/../test-gcc/configure --prefix=$HOME/GCC --enable-languages=c,c++
+
 exit_code=$?
 if [ $exit_code != 0 ]; then
     exit $exit_code
 fi
 
-make -j 16
+make -j$(nproc)
 exit_code=$?
 if [ $exit_code != 0 ]; then
     exit $exit_code
 fi
 
-
 sudo make install
 exit_code=$?
 if [ $exit_code != 0 ]; then
     exit $exit_code
-fi
-
-make -k check -j 16
-../test-gcc/contrib/testsuite-management/validate_failures.py
+fi
\ No newline at end of file
diff --git a/.github/scripts/common.py b/.github/scripts/common.py
new file mode 100644
index 00000000000..85ff1a6d321
--- /dev/null
+++ b/.github/scripts/common.py
@@ -0,0 +1,22 @@
+import globals
+import logging
+
+# Exception class to raise when a basic workflow error happens
+class WorkflowError(Exception):
+    pass
+
+def GetLogger():
+    if (globals.logger == None):
+        logging.basicConfig(level=logging.NOTSET)
+        logging.root.setLevel(logging.DEBUG)
+        globals.logger = logging.getLogger()
+        globals.logger.setLevel(logging.DEBUG)
+    return globals.logger
+
+def RaiseWorkflowError(error):
+    logging.shutdown()
+    raise WorkflowError(error)
+
+# This name needs to match what's in the build.yaml file
+def GetGccBuildName():
+    return 'build'
\ No newline at end of file
diff --git a/.github/scripts/config.py b/.github/scripts/config.py
new file mode 100644
index 00000000000..44d01526540
--- /dev/null
+++ b/.github/scripts/config.py
@@ -0,0 +1,77 @@
+import json
+from json import JSONEncoder
+import globals
+from common import *
+from downloadBuildArtifact import *
+
+# subclass JSONEncoder to convert the Config object into JSON
+class ConfigEncoder(JSONEncoder):
+    def default(self, o):
+        return o.__dict__
+
+class Config(object):
+
+    def __init__(self, sha, token, buildArtifactID):
+        self.commitSHA = sha                         # Commit SHA for the checkin
+        self.accessToken = token                     # Access token for REST APIs
+        self.gccBuildArtifactID = buildArtifactID    # GCC Build artifact ID
+        logger = GetLogger()
+        logger.info('creating an instance of Config')
+
+    @staticmethod
+    def Setup(githubObject, accessToken):
+        logger = GetLogger()
+        
+        logger.debug("In Setup")
+        logger.debug("---")
+        logger.debug("Github object = " + githubObject)
+        githubJson = json.loads(githubObject)
+        logger.debug(githubJson["event"])
+        commit = githubJson["sha"]
+        if ("pull_request" in githubJson["event"]):
+            commit = githubJson["event"]["pull_request"]["head"]["sha"]
+                
+        logger.info("SHA = " + commit)
+        workflowName = githubJson["workflow"]
+
+        # If this isn't the GCC build, wait for the GCC build to complete with the needed artifacts
+        if (workflowName != GetGccBuildName()):
+            gccBuildArtifactID = WaitOnGccBuild(commit, accessToken)
+        else:
+            gccBuildArtifactID = 0
+
+        # Construct Config object
+        newConfig = Config(commit, accessToken, gccBuildArtifactID)
+        configJson = json.dumps(newConfig, cls=ConfigEncoder)
+
+        # Output for Github to pick up output for future steps
+        print("::set-output name=configJson::" + configJson)
+
+        # Set global config object
+        globals.configObj = newConfig
+
+    @staticmethod
+    def PrintNoSecretConfigJson(configJson):
+        # GitHub won't allow the printing of strings with secrets in them for future jobs
+        # so we need to clear out any secrets in our config object prior to printing it
+
+        Config.Reload(configJson)
+
+        # Clear out the access token field
+        globals.configObj.accessToken = globals.configObj.accessToken.replace(globals.configObj.accessToken, '')
+        configJson = json.dumps(globals.configObj, cls=ConfigEncoder)
+
+        # Output for Github to pick up output for future jobs
+        print("::set-output name=noSecretConfigJson::" + configJson)
+
+    @staticmethod
+    def Reload(configJson, accessToken=""):
+        loadedJson = json.loads(configJson)
+        
+        # If no access token is provided, use the one in the config already
+        # This is possible in cases where the config setup and reload functions are run on the same machine
+        if (accessToken==""):
+            accessToken=loadedJson["accessToken"]
+
+        # Set global config object
+        globals.configObj = Config(loadedJson["commitSHA"], accessToken, loadedJson["gccBuildArtifactID"])
diff --git a/.github/scripts/configure-gcc.sh b/.github/scripts/configure-gcc.sh
new file mode 100644
index 00000000000..655a4ced9b0
--- /dev/null
+++ b/.github/scripts/configure-gcc.sh
@@ -0,0 +1,22 @@
+sudo apt update
+
+# Install gcc 7 and g++ 7
+sudo apt-get install gcc-7 g++-7 g++-7-multilib libstdc++-7-doc  binutils-doc build-essential cpp-doc gcc-7-doc libstdc++6-7-dbg lib32stdc++6-7-dbg libx32stdc++6-7-dbg make autoconf automake libtool flex bison gdb gcc-doc libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc python
+
+# Redirect gcc and g++ to the installed versions
+sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 
+sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60
+
+# Redirect cc and c++ to the installed gcc and g++ versions:		
+sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
+sudo update-alternatives --set cc /usr/bin/gcc
+		
+sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
+sudo update-alternatives --set c++ /usr/bin/g++
+
+sudo apt install -y texinfo
+sudo apt-get install -y dejagnu
+./contrib/download_prerequisites
+
+cd ..
+mkdir objdir
\ No newline at end of file
diff --git a/.github/scripts/downloadBuildArtifact.py b/.github/scripts/downloadBuildArtifact.py
new file mode 100644
index 00000000000..1dd8626d05d
--- /dev/null
+++ b/.github/scripts/downloadBuildArtifact.py
@@ -0,0 +1,110 @@
+# Requirements:
+# sudo apt-get install python-pip
+# sudo apt-get install python
+# python -m pip install requests
+
+import requests
+import json
+from datetime import datetime
+import datetime as dt
+import zipfile
+import time
+from common import *
+import globals
+
+def WaitOnGccBuild(commit, accessToken):
+    logger = GetLogger()
+    logger.info("Looking for a gcc build for " + commit)
+    
+    reqArgs = {'check_name': GetGccBuildName()}
+    res = requests.get("https://api.github.com/repos/microsoft/test-gcc/commits/" + commit + "/check-runs", params=reqArgs, headers={'Authorization': "token " + accessToken})
+
+    checkruns = res.json()['check_runs']
+    count = 0
+    latestBuildTime = dt.datetime(1970, 1, 1)
+    latestBuildId = 0
+
+    for entry in checkruns:
+        if (entry['name'] == GetGccBuildName()):
+            date = datetime.strptime(entry['started_at'], '%Y-%m-%dT%H:%M:%SZ')
+            
+            # take the most recent build run
+            if (latestBuildTime < date):
+                latestBuildTime = date
+                latestBuildId = entry['id']
+    
+    if (latestBuildId == 0):
+        RaiseWorkflowError("No run found")
+
+    logger.info("Found latest build workflow ID: " + str(latestBuildId))
+
+    buildStatus = ''
+    while True:
+        # Get the run ID
+        res = requests.get("https://api.github.com/repos/microsoft/test-gcc/actions/jobs/" + str(latestBuildId), headers={'Authorization': "token " + accessToken})
+        jobJson = res.json()
+        workflowRunID = jobJson['run_id']
+        buildStatus = jobJson['status']
+        if (buildStatus == 'completed'):
+            logger.debug(jobJson)
+            conclusion = jobJson['conclusion']
+            if (conclusion == 'success'):
+                break
+            else:
+                logger.error("Job conclusion is: " + conclusion)
+                RaiseWorkflowError("Build run ID " + str(latestBuildId) + " failed")
+        else:
+            # Sleep for 30 seconds
+            sleepTime = 30
+            logger.error("Sleeping for " + str(sleepTime) + " seconds while waiting on build number " + str(latestBuildId) + " to finish")
+            time.sleep(sleepTime) # Sleep takes parameter in seconds
+
+    logger.info("Workflow run ID = " + str(workflowRunID))
+
+    numArtifactRetries = 1
+    # Add error checking for the number of artifacts
+    while True:
+        res = requests.get("https://api.github.com/repos/microsoft/test-gcc/actions/runs/" + str(workflowRunID) + "/artifacts", headers={'Authorization': "token " + accessToken})
+
+        logger.debug("Artifact Json:" + json.dumps(res.json()))
+
+        gccBuildArtifactID = 0
+        for artifact in res.json()['artifacts']:
+            if (artifact['name'] == "gccBuild"):
+                gccBuildArtifactID = artifact['id']
+
+        if (gccBuildArtifactID != 0):
+            break
+        elif (gccBuildArtifactID == 0 and numArtifactRetries == 0):
+            RaiseWorkflowError("No gcc build artifact found")
+
+        numArtifactRetries = numArtifactRetries-1
+
+        # We need this sleep here because even if the build job status is "completed", the gccBuild artifacts aren't
+        # immediately ready. If for some reason they aren't, sleep for a bit and retry once more.
+        
+        # Sleep for 3 minutes
+        sleepTime = 3
+        logger.info("Sleeping for " + str(sleepTime) + " minutes while waiting on artifacts for workflow run ID " + str(workflowRunID))
+        time.sleep(sleepTime * 60) # Sleep takes parameter in seconds
+
+    logger.info("GCC Build artifact ID = " + str(gccBuildArtifactID))
+
+    return gccBuildArtifactID
+
+def DownloadBuildArtifact():
+    logger = GetLogger()
+    gccBuildArtifactID = globals.configObj.gccBuildArtifactID
+
+    # TODO: Support downloading build artifact without a config object setup so the script can be used outside of workflows by developers
+    res = requests.get("https://api.github.com/repos/microsoft/test-gcc/actions/artifacts/" + str(gccBuildArtifactID) +"/zip", headers={'Authorization': "token " + globals.configObj.accessToken})
+    
+    logger.info("Downloading gccBuild zip from artifact ID" + str(gccBuildArtifactID))
+    with open('gccBuild.zip', 'wb') as f:
+        f.write(res.content)
+
+    logger.info("Unzipping zip")
+    with zipfile.ZipFile('gccBuild.zip', 'r') as zip_ref:
+        zip_ref.extractall('gccBuild')   
+
+    logger.info("Done downloading")
diff --git a/.github/scripts/gccWorkflow.py b/.github/scripts/gccWorkflow.py
new file mode 100644
index 00000000000..e0b82413dd1
--- /dev/null
+++ b/.github/scripts/gccWorkflow.py
@@ -0,0 +1,81 @@
+from config import *
+import subprocess
+from downloadBuildArtifact import *
+import sys
+import globals
+from common import *
+
+class GccWorkflow(object):
+    
+    # Setup the config object and wait for any runs necessary to finish before proceeding onto the next job section
+    # to avoid exceeding the 6 hr limit on Github Actions that run on Github machines
+    @staticmethod
+    def Init(githubContext, accessToken):
+        Config.Setup(githubContext, accessToken)
+
+    # Runs the configure script to set up gcc configuration environment prior to building and running tests
+    # Creates the objdir directory as part of this process
+    @staticmethod
+    def Configure():        
+        logger = GetLogger()
+        res = subprocess.run('''
+            chmod +x .github/scripts/configure-gcc.sh
+            .github/scripts/configure-gcc.sh''',
+            shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+        logger.info("output = " + str(res.stdout, 'utf-8'))
+
+    @staticmethod
+    def Build(configJson):
+        logger = GetLogger()
+        logger.info("Gcc Build start")
+        Config.Reload(configJson)
+
+        GccWorkflow.Configure()
+
+        # Build
+        res = subprocess.run('''
+            chmod +x .github/scripts/build-gcc.sh
+            .github/scripts/build-gcc.sh''',
+          shell=True, check=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        logger.info("build output = " + str(res.stdout, 'utf-8'))
+
+        # TODO: Add better handling of errors to display
+        if (res.returncode != 0):
+            logger.error("GCC Build failed")
+            logging.shutdown()
+            sys.exit(res.returncode)
+
+    @staticmethod
+    def Test(configJson, testSet, accessToken):
+        logger = GetLogger()
+        logger.info("Gcc Test start")
+        
+        Config.Reload(configJson, accessToken)
+        
+        logger.info("Downloading build artifact...")
+        try:
+            DownloadBuildArtifact()
+        except:
+            logger.error("Could not download build artifact")
+            RaiseWorkflowError("Error downloading build artifact for GCC workflow")
+        
+        GccWorkflow.Configure()
+        
+        # Copy over downloaded build artifact into objdir directory that was created in the configure script
+        # For more details on the subprocess function and its parameters, 
+        # see https://stackoverflow.com/questions/4256107/running-bash-commands-in-python
+        res = subprocess.run('''
+            mv gccBuild/* ../objdir -f
+            chmod +x .github/scripts/test-gcc.sh
+            ''' 
+            + ".github/scripts/test-gcc.sh " + testSet,
+          shell=True, check=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        logger.info("test output = " + str(res.stdout, 'utf-8'))
+
+        # TODO: Add better handling of errors to display
+        if (res.returncode != 0):
+            logger.error("GCC Test failed")
+            logging.shutdown()
+            sys.exit(res.returncode)
+        
diff --git a/.github/scripts/globals.py b/.github/scripts/globals.py
new file mode 100644
index 00000000000..a44de1846ae
--- /dev/null
+++ b/.github/scripts/globals.py
@@ -0,0 +1,6 @@
+
+# Declare config global variable
+# https://docs.python.org/3/faq/programming.html#how-do-i-share-global-variables-across-modules
+configObj = None
+
+logger = None
\ No newline at end of file
diff --git a/.github/scripts/test-gcc.sh b/.github/scripts/test-gcc.sh
new file mode 100644
index 00000000000..e73820e26b2
--- /dev/null
+++ b/.github/scripts/test-gcc.sh
@@ -0,0 +1,16 @@
+cd ../objdir
+
+chmod +x $PWD -R
+
+make -k $1 -j$(nproc) #RUNTESTFLAGS="-v -v"
+../test-gcc/contrib/testsuite-management/validate_failures.py
+
+exit_code=$?
+if [ $exit_code != 0 ]; then
+    exit $exit_code
+fi
+
+# To run one test in particular, use
+#make check-gcc RUNTESTFLAGS="-v -v dg.exp=c-c++-common/asan/asan-interface-1.c"
+
+
diff --git a/.github/workflows/build-gcc.yaml b/.github/workflows/build-gcc.yaml
deleted file mode 100644
index 35626ea428c..00000000000
--- a/.github/workflows/build-gcc.yaml
+++ /dev/null
@@ -1,106 +0,0 @@
-name: build-gcc
-
-# Run this workflow on every new commit and pull request
-on: [push, pull_request]
-
-# Run this workflow every time a new commit pushed to your repository
-# on: push
-
-jobs:    
-  build:
-    runs-on: ubuntu-18.04
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-        with:
-          fetch-depth: 0
-          submodules: recursive
-          lfs: true
-      - run: | 
-          git log -1
-          dir
-          ls -a
-      
-      - name: Test ls
-        working-directory: gcc
-        run: | 
-          git log -1 
-          dir
-          ls -a
-          
-      - name: Run build script
-        run: | 
-          chmod +x .github/scripts/build-gcc.sh
-          .github/scripts/build-gcc.sh
-        shell: bash
-      
-     # - name: Upload gengtype-lex.c for packaging
-     #   uses: actions/upload-artifact@v2
-     #   with:
-    #      name: gengtype-lex
-     #     path: objdir/gcc/gengtype-lex.c
-        
-  package:
-    runs-on: ubuntu-18.04
-    needs: [build]
-    steps:
-      - name: checkout
-        uses: actions/checkout@v2
-        with:
-          fetch-depth: 0
-          submodules: recursive
-          lfs: true
-   #   - name: Download gengtype-lex.c from build step
-  #      uses: actions/download-artifact@v2
-   #     with:
-   #       name: gengtype-lex
-                      
-    #  - name: Move gengtype-lex.c into gcc directory
-    #    shell: bash
-   #     run: |
-    #      mv gengtype-lex.c gcc/gcc
-      
-      
-          
-      - name: Bump version and push tag
-        id: tagaction
-        uses: mathieudutour/github-tag-action@v4.5
-        with:
-          github_token: ${{ secrets.GITHUB_TOKEN }}
-           
-          
-      - name: Rename gcc folder to gcc-9.1.0
-        run: mv gcc gcc-9.1.0
-          
-      - name: Package sources into tar
-        run: XZ_OPT=-e9T0 tar -cJf gcc-9.1.0.tar.xz gcc-9.1.0
-        shell: bash          
-      - name: upload artifact
-        uses: actions/upload-artifact@v2
-        with:
-          name: gccTar
-          path: gcc-9.1.0.tar.xz
-          
-      - name: Create Release
-        id: create_release
-        uses: actions/create-release@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          tag_name: ${{ steps.tagaction.outputs.new_tag }}
-          release_name: Release ${{ steps.tagaction.outputs.new_tag }}
-          draft: false
-          prerelease: false
-          
-      - name: Upload Release Asset
-        id: upload-release-asset 
-        uses: actions/upload-release-asset@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 
-          asset_path: gcc-9.1.0.tar.xz
-          asset_name: gcc-9.1.0.tar.xz
-          asset_content_type: application/zip
-      - name: Print download URL
-        run: echo "Download URL= ${{ steps.create_release.outputs.download_url }}"
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 00000000000..8e2da1b82a2
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,79 @@
+# This needs to match the string returned in GetGccBuildName() in common.py
+name: build
+
+# Run this workflow on every new commit and pull request
+on: 
+  push:
+    branches:
+      - current
+      - test
+      - 'releases/**'
+      - 'develop/**'
+      - 'gcc**'
+  pull_request:
+    branches:
+      - current
+      - test
+      - 'releases/**'
+      - 'develop/**'
+      - 'gcc**'
+
+jobs:    
+  build:
+    runs-on: ubuntu-18.04
+    steps:
+      - name: checkout
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+          submodules: recursive
+          lfs: true
+
+      - name: Setup Python 3.7
+        uses: actions/setup-python@v1
+        with:
+          python-version: 3.7
+          
+      # Install requests package which is used in downloadBuildArtifact.py 
+      # We need this since python will import packages and even though we aren't using this script in this workflow,
+      # the GCC workflow relies on the download script so the script will end up getting pulled in
+      - name: Pip Install Requests
+        run: |
+          python -m pip install requests
+        shell: bash
+
+      # Setup config
+      - name: Setup config
+        id: setupconfig
+        run: |
+          chmod +x .github/scripts/gccWorkflow.py
+          echo "$PYTHONPATH"
+          export PYTHONPATH=${PYTHONPATH}:${PWD}/.github/scripts
+          echo "$PYTHONPATH"
+          echo "${GITHUB_CONTEXT}"
+          python -c 'import sys; from gccWorkflow import *; GccWorkflow.Init(sys.argv[1], sys.argv[2])' "${GITHUB_CONTEXT}" "${GITHUB_TOKEN}"
+        shell: bash
+        env:
+          GITHUB_CONTEXT: ${{ toJson(github) }}
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      # build.yaml creates the gccBuild artifact
+      - name: Build gcc
+        run: | 
+          chmod +x .github/scripts/gccWorkflow.py
+          echo "$PYTHONPATH"
+          export PYTHONPATH=${PYTHONPATH}:${PWD}/.github/scripts
+          echo "$PYTHONPATH"
+          python -c 'import sys; from gccWorkflow import *; GccWorkflow.Build(sys.argv[1])' "${CONFIG_JSON}"
+        shell: bash
+        env:
+          CONFIG_JSON: ${{ steps.setupconfig.outputs.configJson }}
+
+      - name: Move objdir to be in repo so it can be uploaded
+        run: mv ../objdir objdir
+
+      - name: Upload build output
+        uses: actions/upload-artifact@v2
+        with:
+          name: gccBuild
+          path: objdir
diff --git a/.github/workflows/test-gcc.yaml b/.github/workflows/test-gcc.yaml
new file mode 100644
index 00000000000..a994e1ec56c
--- /dev/null
+++ b/.github/workflows/test-gcc.yaml
@@ -0,0 +1,120 @@
+# This workflow creates a tag and a release for the checkin on the listed branches
+name: test-gcc
+
+# Run this workflow when a build run finishes on the branches listed
+on:  
+  # We use the push and pull_request events instead of the workflow_run event
+  # so that this workflow will show up during the PR
+  push:
+    branches:
+      - current
+      - test
+      - 'releases/**'
+      - 'develop/**'
+      - 'gcc**'
+  pull_request:
+    branches:
+      - current
+      - test
+      - 'releases/**'
+      - 'develop/**'
+      - 'gcc**'
+  # the problem with workflow_run is that the run isn't associated with a PR and won't show up in a PR
+  #workflow_run:
+  #  workflows: ["build"]
+  #  types:
+  #    - completed
+
+jobs:
+  init:
+    runs-on: ubuntu-18.04
+    outputs:
+      config: ${{ steps.printNoSecretJson.outputs.noSecretConfigJson }}
+    steps:
+      - name: checkout
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+          submodules: recursive
+          lfs: true
+
+      - name: Setup Python 3.7
+        uses: actions/setup-python@v1
+        with:
+          python-version: 3.7
+
+      # Install requests package so we can use it for downloading the build artifacts in downloadBuildArtifact.py 
+      - name: Pip Install Requests
+        run: |
+          python -m pip install requests
+        shell: bash
+
+      # Setup config
+      - name: Setup config
+        id: setupconfig
+        run: |
+          chmod +x .github/scripts/gccWorkflow.py
+          export PYTHONPATH=${PYTHONPATH}:${PWD}/.github/scripts
+          python -c 'import sys; from gccWorkflow import *; GccWorkflow.Init(sys.argv[1], sys.argv[2])' "${GITHUB_CONTEXT}" "${GITHUB_TOKEN}"
+        shell: bash
+        env:
+          GITHUB_CONTEXT: ${{ toJson(github) }}
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      # This should be the last step on this machine since it will clear out fields in the config json
+      - name: Print No Secret Json
+        id: printNoSecretJson
+        run: |
+          chmod +x .github/scripts/config.py
+          export PYTHONPATH=${PYTHONPATH}:${PWD}/.github/scripts
+          python -c 'import sys; from config import *; Config.PrintNoSecretConfigJson(sys.argv[1])' "${CONFIG_JSON}"
+        shell: bash
+        env:
+          CONFIG_JSON: ${{ steps.setupconfig.outputs.configJson }}
+  test:
+    needs: init
+    strategy:
+      matrix:
+        testSet: [check-target-libstdc++-v3, check-gcc-c++, check-gcc-c, check-target-libgomp, check-target-libitm, check-target-libatomic]
+      # Avoid cancelling other matrix chunks even if one fails
+      fail-fast: false        
+    runs-on: ubuntu-18.04
+    steps:
+      - run: echo ${{needs.init.outputs.output1}} ${{needs.init.outputs.output2}}
+      - run: echo $GITHUB_CONTEXT
+        env:
+          GITHUB_CONTEXT: ${{ toJson(github) }}
+      - name: checkout
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+          submodules: recursive
+          lfs: true
+
+      - name: Setup Python 3.7
+        uses: actions/setup-python@v1
+        with:
+          python-version: 3.7
+          
+      # Install requests package so we can use it for downloading the build artifacts in downloadBuildArtifact.py 
+      - name: Pip Install Requests
+        run: |
+          python -m pip install requests
+        shell: bash
+
+      # build.yaml creates the gccBuild artifact
+      - name: Download build and run tests
+        run: | 
+          chmod +x .github/scripts/gccWorkflow.py
+          echo ${{needs.init.outputs.config}}
+          echo "$PYTHONPATH"
+          echo "$CONFIG_JSON"
+          export PYTHONPATH=${PYTHONPATH}:${PWD}/.github/scripts
+          echo "$PYTHONPATH"
+          python -c 'import sys; from gccWorkflow import *; GccWorkflow.Test(sys.argv[1], sys.argv[2], sys.argv[3])' "${CONFIG_JSON}" "${TEST_SET}" "${GITHUB_TOKEN}"
+        shell: bash
+        env:
+          CONFIG_JSON: ${{needs.init.outputs.config}}
+          TEST_SET: ${{ matrix.testSet }}
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      
\ No newline at end of file
diff --git a/contrib/testsuite-management/x86_64-pc-linux-gnu.xfail b/contrib/testsuite-management/x86_64-pc-linux-gnu.xfail
index 7504e20c301..dcdef0fe552 100644
--- a/contrib/testsuite-management/x86_64-pc-linux-gnu.xfail
+++ b/contrib/testsuite-management/x86_64-pc-linux-gnu.xfail
@@ -84,3 +84,68 @@ FAIL: gcc.dg/guality/vla-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects
 FAIL: gcc.dg/guality/vla-1.c -O3 -g  -DPREVENT_OPTIMIZATION  line 17 sizeof (a) == 6
 FAIL: gcc.dg/guality/vla-1.c -Os  -DPREVENT_OPTIMIZATION  line 17 sizeof (a) == 6
 FAIL: gcc.dg/plugin/location-overflow-test-1.c -fplugin=./location_overflow_plugin.so adding '-flarge-source-files' (test for warnings, line 16)
+FAIL: g++.dg/guality/pr55665.C -O2 -flto -fno-use-linker-plugin -flto-partition=none  line 23 p == 40
+FAIL: gcc.dg/atomic/pr65345-4.c -O2 -flto -fno-use-linker-plugin -flto-partition=none  (internal compiler error)
+FAIL: gcc.dg/atomic/pr65345-4.c -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
+FAIL: gcc.dg/atomic/pr65345-4.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (internal compiler error)
+FAIL: gcc.dg/atomic/pr65345-4.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
+XPASS: gcc.dg/guality/example.c -O0  execution test
+XPASS: gcc.dg/guality/example.c -O1  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/example.c -Og -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/guality.c -O0  execution test
+XPASS: gcc.dg/guality/guality.c -O1  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/guality.c -O2  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/guality.c -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION execution test
+XPASS: gcc.dg/guality/guality.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION execution test
+XPASS: gcc.dg/guality/guality.c -O3 -g  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/guality.c -Os  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/guality.c -Og -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/inline-params.c -O2  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/inline-params.c -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION execution test
+XPASS: gcc.dg/guality/inline-params.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION execution test
+XPASS: gcc.dg/guality/inline-params.c -O3 -g  -DPREVENT_OPTIMIZATION  execution test
+XPASS: gcc.dg/guality/inline-params.c -Os  -DPREVENT_OPTIMIZATION  execution test
+FAIL: gcc.dg/guality/loop-1.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  -DPREVENT_OPTIMIZATION  line 20 i == 1
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 16 arg1 == 1
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 16 arg2 == 2
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 16 arg3 == 3
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 16 arg4 == 4
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 16 arg5 == 5
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 16 arg6 == 6
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 16 arg7 == 30
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 18 arg1 == 1
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 18 arg2 == 2
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 18 arg3 == 3
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 18 arg4 == 4
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 18 arg5 == 5
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 18 arg6 == 6
+FAIL: gcc.dg/guality/pr36728-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 18 arg7 == 30
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 16 arg1 == 1
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 16 arg2 == 2
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 16 arg3 == 3
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 16 arg4 == 4
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 16 arg5 == 5
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 16 arg6 == 6
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 16 arg7 == 30
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 18 arg1 == 1
+FAIL: gcc.dg/guality/pr36728-2.c -O3 -g  -DPREVENT_OPTIMIZATION  line 18 arg2 == 2
+FAIL: gcc.dg/guality/pr54519-3.c -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line 20 y == 25
+FAIL: gcc.dg/guality/pr54519-3.c -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line 20 z == 6
+FAIL: gcc.dg/guality/pr54519-3.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 20 y == 25
+FAIL: gcc.dg/guality/pr54519-3.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line 20 z == 6
+FAIL: 27_io/filesystem/iterators/directory_iterator.cc execution test
+FAIL: 27_io/filesystem/iterators/recursive_directory_iterator.cc execution test
+FAIL: 27_io/filesystem/operations/exists.cc execution test
+FAIL: 27_io/filesystem/operations/is_empty.cc execution test
+FAIL: 27_io/filesystem/operations/remove.cc execution test
+FAIL: 27_io/filesystem/operations/remove_all.cc execution test
+FAIL: 27_io/filesystem/operations/status.cc execution test
+FAIL: 27_io/filesystem/operations/symlink_status.cc execution test
+FAIL: 27_io/filesystem/operations/temp_directory_path.cc execution test
+FAIL: experimental/filesystem/iterators/directory_iterator.cc execution test
+FAIL: experimental/filesystem/iterators/recursive_directory_iterator.cc execution test
+FAIL: experimental/filesystem/operations/exists.cc execution test
+FAIL: experimental/filesystem/operations/is_empty.cc execution test
+FAIL: experimental/filesystem/operations/remove.cc execution test
+FAIL: experimental/filesystem/operations/remove_all.cc execution test
+FAIL: experimental/filesystem/operations/temp_directory_path.cc execution test


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-16 20:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 20:36 [gcc(refs/vendors/microsoft/heads/main)] Build and test separation changes (#31) Eugene Rozenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).