prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Exercise TVM under minimal configuration in CI
  We have seen a couple bugs due to microTVM being presumed-ON in config.cmake. Namely, you get python errors importing TVM right now when USE_MICRO is OFF. We should have a regression test that verifies basic functionality with everything (or nearly everything) OFF.
  
  Context: apache/tvm#9617
  And another micro-related issue of the same kind, which i don't have handy right now.
  
  cc @gigiblender 
  
  </issue>
  <code>
  [start of ci/jenkins/generate.py]
  1 #!/usr/bin/env python3
  2 # Licensed to the Apache Software Foundation (ASF) under one
  3 # or more contributor license agreements.  See the NOTICE file
  4 # distributed with this work for additional information
  5 # regarding copyright ownership.  The ASF licenses this file
  6 # to you under the Apache License, Version 2.0 (the
  7 # "License"); you may not use this file except in compliance
  8 # with the License.  You may obtain a copy of the License at
  9 #
  10 #   http://www.apache.org/licenses/LICENSE-2.0
  11 #
  12 # Unless required by applicable law or agreed to in writing,
  13 # software distributed under the License is distributed on an
  14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15 # KIND, either express or implied.  See the License for the
  16 # specific language governing permissions and limitations
  17 # under the License.
  18 import jinja2
  19 import argparse
  20 import difflib
  21 import re
  22 import datetime
  23 import textwrap
  24 
  25 from pathlib import Path
  26 
  27 
  28 REPO_ROOT = Path(__file__).resolve().parent.parent.parent
  29 JENKINSFILE_TEMPLATE = REPO_ROOT / "ci" / "jenkins" / "Jenkinsfile.j2"
  30 JENKINSFILE = REPO_ROOT / "Jenkinsfile"
  31 
  32 
  33 data = {
  34     "images": [
  35         {
  36             "name": "ci_arm",
  37             "platform": "ARM",
  38         },
  39         {
  40             "name": "ci_cpu",
  41             "platform": "CPU",
  42         },
  43         {
  44             "name": "ci_gpu",
  45             "platform": "CPU",
  46         },
  47         {
  48             "name": "ci_hexagon",
  49             "platform": "CPU",
  50         },
  51         {
  52             "name": "ci_i386",
  53             "platform": "CPU",
  54         },
  55         {
  56             "name": "ci_lint",
  57             "platform": "CPU",
  58         },
  59         {
  60             "name": "ci_cortexm",
  61             "platform": "CPU",
  62         },
  63         {
  64             "name": "ci_wasm",
  65             "platform": "CPU",
  66         },
  67     ]
  68 }
  69 
  70 
  71 def lines_without_generated_tag(content):
  72     return [
  73         line for line in content.splitlines(keepends=True) if not line.startswith("// Generated at")
  74     ]
  75 
  76 
  77 if __name__ == "__main__":
  78     help = "Regenerate Jenkinsfile from template"
  79     parser = argparse.ArgumentParser(description=help)
  80     parser.add_argument("--check", action="store_true", help="just verify the output didn't change")
  81     args = parser.parse_args()
  82 
  83     with open(JENKINSFILE) as f:
  84         content = f.read()
  85 
  86     data["generated_time"] = datetime.datetime.now().isoformat()
  87 
  88     environment = jinja2.Environment(
  89         loader=jinja2.FileSystemLoader(REPO_ROOT),
  90         undefined=jinja2.StrictUndefined,
  91         lstrip_blocks=True,
  92         trim_blocks=True,
  93         keep_trailing_newline=True,
  94     )
  95     template = environment.get_template(str(JENKINSFILE_TEMPLATE.relative_to(REPO_ROOT)))
  96     new_content = template.render(**data)
  97 
  98     diff = "".join(
  99         difflib.unified_diff(
  100             lines_without_generated_tag(content), lines_without_generated_tag(new_content)
  101         )
  102     )
  103     if args.check:
  104         if not diff:
  105             print("Success, the newly generated Jenkinsfile matched the one on disk")
  106             exit(0)
  107         else:
  108             print(
  109                 textwrap.dedent(
  110                     """
  111                 Newly generated Jenkinsfile did not match the one on disk! If you have made
  112                 edits to the Jenkinsfile, move them to 'jenkins/Jenkinsfile.j2' and
  113                 regenerate the Jenkinsfile from the template with
  114 
  115                     python3 -m pip install -r jenkins/requirements.txt
  116                     python3 jenkins/generate.py
  117 
  118                 Diffed changes:
  119             """
  120                 ).strip()
  121             )
  122             print(diff)
  123             exit(1)
  124     else:
  125         with open(JENKINSFILE, "w") as f:
  126             f.write(new_content)
  127         if not diff:
  128             print(f"Wrote output to {JENKINSFILE.relative_to(REPO_ROOT)}, no changes made")
  129         else:
  130             print(f"Wrote output to {JENKINSFILE.relative_to(REPO_ROOT)}, changes:")
  131             print(diff)
  132
  [end of ci/jenkins/generate.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/ci/jenkins/generate.py b/ci/jenkins/generate.py
  --- a/ci/jenkins/generate.py
  +++ b/ci/jenkins/generate.py
  @@ -40,6 +40,10 @@
               "name": "ci_cpu",
               "platform": "CPU",
           },
  +        {
  +            "name": "ci_minimal",
  +            "platform": "CPU",
  +        },
           {
               "name": "ci_gpu",
               "platform": "CPU",
  
verification_info: {"golden_diff": "diff --git a/ci/jenkins/generate.py b/ci/jenkins/generate.py\n--- a/ci/jenkins/generate.py\n+++ b/ci/jenkins/generate.py\n@@ -40,6 +40,10 @@\n             \"name\": \"ci_cpu\",\n             \"platform\": \"CPU\",\n         },\n+        {\n+            \"name\": \"ci_minimal\",\n+            \"platform\": \"CPU\",\n+        },\n         {\n             \"name\": \"ci_gpu\",\n             \"platform\": \"CPU\",\n", "issue": "Exercise TVM under minimal configuration in CI\nWe have seen a couple bugs due to microTVM being presumed-ON in config.cmake. Namely, you get python errors importing TVM right now when USE_MICRO is OFF. We should have a regression test that verifies basic functionality with everything (or nearly everything) OFF.\r\n\r\nContext: apache/tvm#9617\r\nAnd another micro-related issue of the same kind, which i don't have handy right now.\r\n\r\ncc @gigiblender \n", "before_files": [{"content": "#!/usr/bin/env python3\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\nimport jinja2\nimport argparse\nimport difflib\nimport re\nimport datetime\nimport textwrap\n\nfrom pathlib import Path\n\n\nREPO_ROOT = Path(__file__).resolve().parent.parent.parent\nJENKINSFILE_TEMPLATE = REPO_ROOT / \"ci\" / \"jenkins\" / \"Jenkinsfile.j2\"\nJENKINSFILE = REPO_ROOT / \"Jenkinsfile\"\n\n\ndata = {\n    \"images\": [\n        {\n            \"name\": \"ci_arm\",\n            \"platform\": \"ARM\",\n        },\n        {\n            \"name\": \"ci_cpu\",\n            \"platform\": \"CPU\",\n        },\n        {\n            \"name\": \"ci_gpu\",\n            \"platform\": \"CPU\",\n        },\n        {\n            \"name\": \"ci_hexagon\",\n            \"platform\": \"CPU\",\n        },\n        {\n            \"name\": \"ci_i386\",\n            \"platform\": \"CPU\",\n        },\n        {\n            \"name\": \"ci_lint\",\n            \"platform\": \"CPU\",\n        },\n        {\n            \"name\": \"ci_cortexm\",\n            \"platform\": \"CPU\",\n        },\n        {\n            \"name\": \"ci_wasm\",\n            \"platform\": \"CPU\",\n        },\n    ]\n}\n\n\ndef lines_without_generated_tag(content):\n    return [\n        line for line in content.splitlines(keepends=True) if not line.startswith(\"// Generated at\")\n    ]\n\n\nif __name__ == \"__main__\":\n    help = \"Regenerate Jenkinsfile from template\"\n    parser = argparse.ArgumentParser(description=help)\n    parser.add_argument(\"--check\", action=\"store_true\", help=\"just verify the output didn't change\")\n    args = parser.parse_args()\n\n    with open(JENKINSFILE) as f:\n        content = f.read()\n\n    data[\"generated_time\"] = datetime.datetime.now().isoformat()\n\n    environment = jinja2.Environment(\n        loader=jinja2.FileSystemLoader(REPO_ROOT),\n        undefined=jinja2.StrictUndefined,\n        lstrip_blocks=True,\n        trim_blocks=True,\n        keep_trailing_newline=True,\n    )\n    template = environment.get_template(str(JENKINSFILE_TEMPLATE.relative_to(REPO_ROOT)))\n    new_content = template.render(**data)\n\n    diff = \"\".join(\n        difflib.unified_diff(\n            lines_without_generated_tag(content), lines_without_generated_tag(new_content)\n        )\n    )\n    if args.check:\n        if not diff:\n            print(\"Success, the newly generated Jenkinsfile matched the one on disk\")\n            exit(0)\n        else:\n            print(\n                textwrap.dedent(\n                    \"\"\"\n                Newly generated Jenkinsfile did not match the one on disk! If you have made\n                edits to the Jenkinsfile, move them to 'jenkins/Jenkinsfile.j2' and\n                regenerate the Jenkinsfile from the template with\n\n                    python3 -m pip install -r jenkins/requirements.txt\n                    python3 jenkins/generate.py\n\n                Diffed changes:\n            \"\"\"\n                ).strip()\n            )\n            print(diff)\n            exit(1)\n    else:\n        with open(JENKINSFILE, \"w\") as f:\n            f.write(new_content)\n        if not diff:\n            print(f\"Wrote output to {JENKINSFILE.relative_to(REPO_ROOT)}, no changes made\")\n        else:\n            print(f\"Wrote output to {JENKINSFILE.relative_to(REPO_ROOT)}, changes:\")\n            print(diff)\n", "path": "ci/jenkins/generate.py"}]}