aboutsummaryrefslogtreecommitdiffstats
path: root/testing/crystal/fix-codegen-specs.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-03-26 02:35:18 +0200
committerJakub Jirutka <jakub@jirutka.cz>2018-03-26 02:36:13 +0200
commitd1ec5ba2a10235eecde65f664bff3aadc07cb5cc (patch)
treeaf00c18da9e446950aca0f76350823033476941f /testing/crystal/fix-codegen-specs.patch
parent481cc18a76406bfe12f4c0ad4e806cfaad1a4e5b (diff)
downloadaports-d1ec5ba2a10235eecde65f664bff3aadc07cb5cc.tar.bz2
aports-d1ec5ba2a10235eecde65f664bff3aadc07cb5cc.tar.xz
testing/crystal: fix tests and enable check
Diffstat (limited to 'testing/crystal/fix-codegen-specs.patch')
-rw-r--r--testing/crystal/fix-codegen-specs.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/testing/crystal/fix-codegen-specs.patch b/testing/crystal/fix-codegen-specs.patch
new file mode 100644
index 0000000000..6198f392e0
--- /dev/null
+++ b/testing/crystal/fix-codegen-specs.patch
@@ -0,0 +1,117 @@
+From 19bad9d05b723980551eb203715456e700b06002 Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 26 Mar 2018 00:44:52 +0200
+Subject: [PATCH 1/2] Fix codegen/asm specs to run x86 ASM only on x86_64 and
+ i686
+
+See https://github.com/crystal-lang/crystal/pull/5861#issuecomment-376006679
+
+Upstream-Issue: https://github.com/crystal-lang/crystal/pull/5866
+---
+ spec/compiler/codegen/asm_spec.cr | 59 ++++++++++++++++++++-------------------
+ 1 file changed, 31 insertions(+), 28 deletions(-)
+
+diff --git a/spec/compiler/codegen/asm_spec.cr b/spec/compiler/codegen/asm_spec.cr
+index 6fe8cbc26e..bc68d0f0cc 100644
+--- a/spec/compiler/codegen/asm_spec.cr
++++ b/spec/compiler/codegen/asm_spec.cr
+@@ -1,34 +1,37 @@
+ require "../../spec_helper"
+
+ describe "Code gen: asm" do
+- it "codegens without inputs" do
+- run(%(
+- dst = uninitialized Int32
+- asm("mov $$1234, $0" : "=r"(dst))
+- dst
+- )).to_i.should eq(1234)
+- end
++ # TODO: arm asm tests
++ {% if flag?(:i686) || flag?(:x86_64) %}
++ it "codegens without inputs" do
++ run(%(
++ dst = uninitialized Int32
++ asm("mov $$1234, $0" : "=r"(dst))
++ dst
++ )).to_i.should eq(1234)
++ end
+
+- it "codegens with one input" do
+- run(%(
+- src = 1234
+- dst = uninitialized Int32
+- asm("mov $1, $0" : "=r"(dst) : "r"(src))
+- dst
+- )).to_i.should eq(1234)
+- end
++ it "codegens with one input" do
++ run(%(
++ src = 1234
++ dst = uninitialized Int32
++ asm("mov $1, $0" : "=r"(dst) : "r"(src))
++ dst
++ )).to_i.should eq(1234)
++ end
+
+- it "codegens with two inputs" do
+- run(%(
+- c = uninitialized Int32
+- a = 20
+- b = 22
+- asm(
+- "add $2, $0"
+- : "=r"(c)
+- : "0"(a), "r"(b)
+- )
+- c
+- )).to_i.should eq(42)
+- end
++ it "codegens with two inputs" do
++ run(%(
++ c = uninitialized Int32
++ a = 20
++ b = 22
++ asm(
++ "add $2, $0"
++ : "=r"(c)
++ : "0"(a), "r"(b)
++ )
++ c
++ )).to_i.should eq(42)
++ end
++ {% end %}
+ end
+
+From bde57387cf7239dea152b870471500da8faaec6f Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 26 Mar 2018 00:48:14 +0200
+Subject: [PATCH 2/2] Fix codegen/sizeof specs for aarch64 (and other 64bit
+ arches)
+
+See https://github.com/crystal-lang/crystal/pull/5861#issuecomment-376006679
+---
+ spec/compiler/codegen/sizeof_spec.cr | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/spec/compiler/codegen/sizeof_spec.cr b/spec/compiler/codegen/sizeof_spec.cr
+index 2f703abd1c..bc4a2d5b9a 100644
+--- a/spec/compiler/codegen/sizeof_spec.cr
++++ b/spec/compiler/codegen/sizeof_spec.cr
+@@ -48,7 +48,7 @@ describe "Code gen: sizeof" do
+ # be struct { 8 bytes, 8 bytes }.
+ #
+ # In 32 bits structs are aligned to 4 bytes, so it remains the same.
+- {% if flag?(:x86_64) %}
++ {% if flag?(:bits64) %}
+ size.should eq(16)
+ {% else %}
+ size.should eq(12)
+@@ -137,7 +137,7 @@ describe "Code gen: sizeof" do
+ sizeof(typeof(foo))
+ )).to_i
+
+- {% if flag?(:x86_64) %}
++ {% if flag?(:bits64) %}
+ size.should eq(8)
+ {% else %}
+ size.should eq(4)