llvm-test-suite icon indicating copy to clipboard operation
llvm-test-suite copied to clipboard

Port gcc-dg tests from GCC

Open mohammed-nurulhoque opened this issue 1 year ago • 11 comments

This was copied from a snapshot of gcc at 0c37fef39fa. The allowlist was tested using glibc and qemu on riscv. Would appreciate any help regarding copyrights, what notices should be included

mohammed-nurulhoque avatar Nov 14 '23 10:11 mohammed-nurulhoque

Cool, I am going to test it in our downstream.

jerryzj avatar Nov 14 '23 12:11 jerryzj

In the main branch, lit has 2437 test cases. However, in your branch, lit is missing 1503 test cases.

jerryzj avatar Nov 15 '23 16:11 jerryzj

Why not keep these tests out-of-tree like SPEC benchmarks? I think they are licensed under GPL.

dtcxzyw avatar Nov 15 '23 16:11 dtcxzyw

Why not keep these tests out-of-tree like SPEC benchmarks? I think they are licensed under GPL.

The test suite already has a variety of different licenses, including GPL. I think it's convenient to have the sources in-tree when the license allows it. Are there any other tests that are kept out of tree that are open source?

asb avatar Nov 15 '23 16:11 asb

Build failed on my end, please consider add the following

Fixed. The error flags where supposed to be excluded by regex

mohammed-nurulhoque avatar Nov 22 '23 16:11 mohammed-nurulhoque

In the main branch, lit has 2437 test cases. However, in your branch, lit is missing 1503 test cases.

Do you mean gcc main? This PR only added the tests directly in gcc.dg without the subdirectories. If you mean the main of this repo, this PR only adds tests. It doesn't remove.

mohammed-nurulhoque avatar Nov 22 '23 16:11 mohammed-nurulhoque

Do you mean gcc main? This PR only added the tests directly in gcc.dg without the subdirectories. If you mean the main of this repo, this PR only adds tests. It doesn't remove.

No. I meant llvm-test-suite. Your patch causes the entire test suite to lose many test cases. Another thing I noticed is that your newly added tests don't even start. You can check the test.log for more details.

The test result of llvm-test-suite main

********************
Failed Tests (2):
  test-suite :: SingleSource/UnitTests/X86/x86-dyn_stack_alloc_realign.test
  test-suite :: SingleSource/UnitTests/X86/x86-dyn_stack_alloc_realign2.test


Testing Time: 152.57s
  Passed: 2509
  Failed:    2

On your branch

********************
Failed Tests (2):
  test-suite :: SingleSource/UnitTests/X86/x86-dyn_stack_alloc_realign.test
  test-suite :: SingleSource/UnitTests/X86/x86-dyn_stack_alloc_realign2.test


Testing Time: 151.32s
  Passed: 948
  Failed:   2

jerryzj avatar Nov 23 '23 09:11 jerryzj

Your patch causes the entire test suite to lose many test cases.

Oh that was probably because my branch wasn't rebased to latest master. I did now

Another thing I noticed is that your newly added tests don't even start

It wasn't included by default. Had to be included explcitly with -DTEST_SUITE_SUBDIRS. Now changed to include by default.

mohammed-nurulhoque avatar Nov 23 '23 11:11 mohammed-nurulhoque

Gentle ping for this

mohammed-nurulhoque avatar Nov 29 '23 09:11 mohammed-nurulhoque

I'm getting the following error on x86 clang 17.0.4

FAILED: SingleSource/Regression/C/gcc-dg/GCC-DG_atomic-compare-exchange-5
: && /home/jzhangjian/scratch/llvm-test-suite/build/tools/timeit --summary SingleSource/Regression/C/gcc-dg/GCC-DG_atomic-compare-exchange-5.link.time /sifive/tools/clang/17.0.4/bin/clang -O3  SingleSource/Regression/C/gcc-dg/CMakeFiles/GCC-DG_atomic-compare-exchange-5.dir/atomic-compare-exchange-5.c.o -o SingleSource/Regression/C/gcc-dg/GCC-DG_atomic-compare-exchange-5   && cd /home/jzhangjian/scratch/llvm-test-suite/build/SingleSource/Regression/C/gcc-dg && /sifive/tools/clang/17.0.4/bin/llvm-size --format=sysv /home/jzhangjian/scratch/llvm-test-suite/build/SingleSource/Regression/C/gcc-dg/GCC-DG_atomic-compare-exchange-5 > /home/jzhangjian/scratch/llvm-test-suite/build/SingleSource/Regression/C/gcc-dg/GCC-DG_atomic-compare-exchange-5.size
SingleSource/Regression/C/gcc-dg/CMakeFiles/GCC-DG_atomic-compare-exchange-5.dir/atomic-compare-exchange-5.c.o: In function `main':
atomic-compare-exchange-5.c:(.text+0x31): undefined reference to `__atomic_compare_exchange'
atomic-compare-exchange-5.c:(.text+0x7d): undefined reference to `__atomic_compare_exchange'
atomic-compare-exchange-5.c:(.text+0xd7): undefined reference to `__atomic_compare_exchange'
atomic-compare-exchange-5.c:(.text+0x149): undefined reference to `__atomic_compare_exchange'
atomic-compare-exchange-5.c:(.text+0x199): undefined reference to `__atomic_compare_exchange'
SingleSource/Regression/C/gcc-dg/CMakeFiles/GCC-DG_atomic-compare-exchange-5.dir/atomic-compare-exchange-5.c.o:atomic-compare-exchange-5.c:(.text+0x205): more undefined references to `__atomic_compare_exchange' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

I suppose that we need -latomic linker flag to fix this.

jerryzj avatar Nov 30 '23 17:11 jerryzj

Hi all, I've picked up and continued Mohammed's work in a new MR here - I hope this is the appropriate workflow, please let me know if I should do this differently.

mablinov avatar Jan 05 '24 10:01 mablinov