• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

修订版0b2170987c2e16f2137913b9aa0a4e29453cbc57 (tree)
时间2020-05-28 08:38:08
作者Giuliano Belinassi <giuliano.belinassi@usp....>
CommiterGiuliano Belinassi

Log Message

Add test for driver

This commit adds some tests to the gcc' driver, which are already
covered by bootstrap. However, here we have a quick way of testing
things.

gcc/testsuite/ChangeLog
2020-05-27 Giuliano Belinassi <giuliano.belinassi@usp.br>

* gcc.dg/driver/driver.exp: New test.
* gcc.dg/driver/a.c: New file.
* gcc.dg/driver/b.c: New file.
* gcc.dg/driver/a.c: New file.

更改概述

差异

--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
1+2020-05-27 Giuliano Belinassi <giuliano.belinassi@usp.br>
2+
3+ * gcc.dg/driver/driver.exp: New test.
4+ * gcc.dg/driver/a.c: New file.
5+ * gcc.dg/driver/b.c: New file.
6+ * gcc.dg/driver/a.c: New file.
7+
18 2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
29
310 * gnat.dg/aggr29.adb: New test.
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/a.c
@@ -0,0 +1,6 @@
1+int puts (const char *);
2+
3+void a_func (void)
4+{
5+ puts ("A test");
6+}
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/b.c
@@ -0,0 +1,6 @@
1+int puts (const char *);
2+
3+void a_func (void)
4+{
5+ puts ("Another test");
6+}
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/driver.exp
@@ -0,0 +1,77 @@
1+# Copyright (C) 2008-2020 Free Software Foundation, Inc.
2+
3+# This program is free software; you can redistribute it and/or modify
4+# it under the terms of the GNU General Public License as published by
5+# the Free Software Foundation; either version 3 of the License, or
6+# (at your option) any later version.
7+#
8+# This program is distributed in the hope that it will be useful,
9+# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+# GNU General Public License for more details.
12+#
13+# You should have received a copy of the GNU General Public License
14+# along with GCC; see the file COPYING3. If not see
15+# <http://www.gnu.org/licenses/>.
16+
17+# GCC testsuite that uses the `dg.exp' driver.
18+
19+# Load support procs.
20+load_lib gcc-dg.exp
21+
22+proc check-for-errors { test input } {
23+ if { [string equal "$input" ""] } then {
24+ pass "$test: std out"
25+ } else {
26+ fail "$test: std out\n$input"
27+ }
28+}
29+
30+if ![check_effective_target_pthread] {
31+ return
32+}
33+
34+# If a testcase doesn't have special options, use these.
35+global DEFAULT_CFLAGS
36+if ![info exists DEFAULT_CFLAGS] then {
37+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
38+}
39+
40+# Initialize `dg'.
41+dg-init
42+
43+
44+# Test multi-input compilation
45+check-for-errors "Multi-input Compilation" \
46+ [gcc_target_compile "$srcdir/$subdir/a.c $srcdir/$subdir/b.c -c" "" none ""]
47+
48+# Compile file and generate an assembler and object file
49+check-for-errors "Object Generation" \
50+ [gcc_target_compile "$srcdir/$subdir/a.c -c" "a.o" none ""]
51+check-for-errors "Object Generation" \
52+ [gcc_target_compile "$srcdir/$subdir/b.c -c" "a.o" none ""]
53+check-for-errors "Asembler Generation" \
54+ [gcc_target_compile "$srcdir/$subdir/a.c -S" "a.S" none ""]
55+check-for-errors "Asembler Generation" \
56+ [gcc_target_compile "$srcdir/$subdir/b.c -S" "b.S" none ""]
57+
58+# Test object file passthrough
59+check-for-errors "Object file passthrough" \
60+ [gcc_target_compile "$srcdir/$subdir/foo.c a.o" "a.exe" none ""]
61+
62+
63+# Test compilation when assembler is provided
64+check-for-errors "Assembler with Macros" \
65+ [gcc_target_compile "a.S -c" "a.o" none ""]
66+
67+# Clean temporary generated files.
68+set temp_files {"a.o" "a.S" "b.o" "b.S"}
69+
70+foreach f $temp_files {
71+ if { [file exists $f] } {
72+ file delete $f
73+ }
74+}
75+
76+# All done.
77+dg-finish
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/foo.c
@@ -0,0 +1,7 @@
1+void a_func (void);
2+
3+int main()
4+{
5+ a_func ();
6+ return 0;
7+}