aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2020-05-27 20:38:08 -0300
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-05-27 20:38:08 -0300
commit0b2170987c2e16f2137913b9aa0a4e29453cbc57 (patch)
treeb5ab77ac9ec2b6094bdd42f2bf6bae9fa80845db /gcc
parent6600738d96c8e862c0c8272b302f01e4fab4dca2 (diff)
downloadgcc-0b2170987c2e16f2137913b9aa0a4e29453cbc57.zip
gcc-0b2170987c2e16f2137913b9aa0a4e29453cbc57.tar.gz
gcc-0b2170987c2e16f2137913b9aa0a4e29453cbc57.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/driver/a.c6
-rw-r--r--gcc/testsuite/gcc.dg/driver/b.c6
-rw-r--r--gcc/testsuite/gcc.dg/driver/driver.exp77
-rw-r--r--gcc/testsuite/gcc.dg/driver/foo.c7
5 files changed, 103 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7f97394..d854181 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2020-05-05 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/aggr29.adb: New test.
diff --git a/gcc/testsuite/gcc.dg/driver/a.c b/gcc/testsuite/gcc.dg/driver/a.c
new file mode 100644
index 0000000..c6b8c2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/a.c
@@ -0,0 +1,6 @@
+int puts (const char *);
+
+void a_func (void)
+{
+ puts ("A test");
+}
diff --git a/gcc/testsuite/gcc.dg/driver/b.c b/gcc/testsuite/gcc.dg/driver/b.c
new file mode 100644
index 0000000..76a2cba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/b.c
@@ -0,0 +1,6 @@
+int puts (const char *);
+
+void a_func (void)
+{
+ puts ("Another test");
+}
diff --git a/gcc/testsuite/gcc.dg/driver/driver.exp b/gcc/testsuite/gcc.dg/driver/driver.exp
new file mode 100644
index 0000000..915cbed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/driver.exp
@@ -0,0 +1,77 @@
+# Copyright (C) 2008-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+proc check-for-errors { test input } {
+ if { [string equal "$input" ""] } then {
+ pass "$test: std out"
+ } else {
+ fail "$test: std out\n$input"
+ }
+}
+
+if ![check_effective_target_pthread] {
+ return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+
+# Test multi-input compilation
+check-for-errors "Multi-input Compilation" \
+ [gcc_target_compile "$srcdir/$subdir/a.c $srcdir/$subdir/b.c -c" "" none ""]
+
+# Compile file and generate an assembler and object file
+check-for-errors "Object Generation" \
+ [gcc_target_compile "$srcdir/$subdir/a.c -c" "a.o" none ""]
+check-for-errors "Object Generation" \
+ [gcc_target_compile "$srcdir/$subdir/b.c -c" "a.o" none ""]
+check-for-errors "Asembler Generation" \
+ [gcc_target_compile "$srcdir/$subdir/a.c -S" "a.S" none ""]
+check-for-errors "Asembler Generation" \
+ [gcc_target_compile "$srcdir/$subdir/b.c -S" "b.S" none ""]
+
+# Test object file passthrough
+check-for-errors "Object file passthrough" \
+ [gcc_target_compile "$srcdir/$subdir/foo.c a.o" "a.exe" none ""]
+
+
+# Test compilation when assembler is provided
+check-for-errors "Assembler with Macros" \
+ [gcc_target_compile "a.S -c" "a.o" none ""]
+
+# Clean temporary generated files.
+set temp_files {"a.o" "a.S" "b.o" "b.S"}
+
+foreach f $temp_files {
+ if { [file exists $f] } {
+ file delete $f
+ }
+}
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/driver/foo.c b/gcc/testsuite/gcc.dg/driver/foo.c
new file mode 100644
index 0000000..a18fd2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/driver/foo.c
@@ -0,0 +1,7 @@
+void a_func (void);
+
+int main()
+{
+ a_func ();
+ return 0;
+}