grin-compiler / grin

GRIN is a compiler back-end for lazy and strict functional languages with whole program optimization support.
https://grin-compiler.github.io/
1.03k stars 38 forks source link

Fix E2E tests for OSX #57

Open luc-tielen opened 4 years ago

luc-tielen commented 4 years ago

When running the e2e tests on OSX, a test failed which checks the generated assembly:

  test/Test/EndToEnd.hs:245:25:
  3) End to end tests, test-data, sum-simple, pipeline-test: sum_simple_exp.grin
       expected:    .text
                    .file   "<string>"
                    .globl  grinMain                # -- Begin function grinMain
                    .p2align    4, 0x90
                    .type   grinMain,@function
                 grinMain:                               # @grinMain
                    .cfi_startproc
                 # %bb.0:                                # %grinMain.entry
                    movl    $50005000, %edi         # imm = 0x2FB0408
                    jmp _prim_int_print         # TAILCALL
                 .Lfunc_end0:
                    .size   grinMain, .Lfunc_end0-grinMain
                    .cfi_endproc
                                                         # -- End function
                    .type   _heap_ptr_,@object      # @_heap_ptr_
                    .bss
                    .globl  _heap_ptr_
                    .p2align    3
                 _heap_ptr_:
                    .quad   0                       # 0x0
                    .size   _heap_ptr_, 8

                    .section    ".note.GNU-stack","",@progbits

        but got:    .section    __TEXT,__text,regular,pure_instructions
                    .macosx_version_min 10, 13
                    .globl  _grinMain               ## -- Begin function grinMain
                    .p2align    4, 0x90
                 _grinMain:                              ## @grinMain
                    .cfi_startproc
                 ## %bb.0:                               ## %grinMain.entry
                    movl    $50005000, %edi         ## imm = 0x2FB0408
                    jmp __prim_int_print        ## TAILCALL
                    .cfi_endproc
                                                         ## -- End function
                    .globl  __heap_ptr_             ## @_heap_ptr_
                 .zerofill __DATA,__common,__heap_ptr_,8,3

                 .subsections_via_symbols

On first look, code seems to be ok (I see the sum constant in the assembly). Should we make it so there are 2 files it can check against depending on current OS?

andorp commented 4 years ago

Checking against the current OS would be sufficient.