[llvm-commits] [dragonegg] r152944 - in /dragonegg/trunk: Makefile test/README test/correctness/ test/correctness/c/ test/correctness/c/sv.c test/correctness/dragonegg-lit.cfg test/dragonegg-lit.site.cfg.in
Duncan Sands
baldrick at free.fr
Fri Mar 16 13:55:20 PDT 2012
Author: baldrick
Date: Fri Mar 16 15:55:19 2012
New Revision: 152944
URL: http://llvm.org/viewvc/llvm-project?rev=152944&view=rev
Log:
Begin porting the old LLVM Frontend testsuites.
Added:
dragonegg/trunk/test/correctness/
dragonegg/trunk/test/correctness/c/
dragonegg/trunk/test/correctness/c/sv.c
dragonegg/trunk/test/correctness/dragonegg-lit.cfg
Modified:
dragonegg/trunk/Makefile
dragonegg/trunk/test/README
dragonegg/trunk/test/dragonegg-lit.site.cfg.in
Modified: dragonegg/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Makefile?rev=152944&r1=152943&r2=152944&view=diff
==============================================================================
--- dragonegg/trunk/Makefile (original)
+++ dragonegg/trunk/Makefile Fri Mar 16 15:55:19 2012
@@ -20,6 +20,8 @@
# Where to find the lit.py script and modules, used for running tests.
LIT_DIR?=$(shell $(LLVM_CONFIG) --src-root)/utils/lit
+# Where to find LLVM utils, used for running tests.
+LLVM_TOOLS_DIR?=$(shell $(LLVM_CONFIG) --obj-root)/$(shell $(LLVM_CONFIG) --build-mode)/bin/
INCLUDE_DIR=$(TOP_DIR)/include
SRC_DIR=$(TOP_DIR)/src
@@ -43,6 +45,7 @@
GCC_MAJOR=$(word 1, $(subst ., ,$(GCC_VERSION)))
GCC_MINOR=$(word 2, $(subst ., ,$(GCC_VERSION)))
GCC_MICRO=$(word 3, $(subst ., ,$(GCC_VERSION)))
+GCC_LANGUAGES=$(shell $(GCC) -v 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/')
TARGET_TRIPLE:=$(shell $(GCC) -dumpmachine)
LLVM_VERSION:=$(shell $(LLVM_CONFIG) --version)
@@ -119,15 +122,25 @@
$(QUIET)mkdir -p test
$(QUIET)echo s=@DRAGONEGG_PLUGIN@=$(CURDIR)/$(PLUGIN)=g > lit.tmp
$(QUIET)echo s=@GCC@=$(GCC)=g >> lit.tmp
+ $(QUIET)echo s=@GCC_LANGUAGES@=$(GCC_LANGUAGES)=g >> lit.tmp
+ $(QUIET)echo s=@LLVM_TOOLS_DIR@=$(LLVM_TOOLS_DIR)=g >> lit.tmp
+ $(QUIET)echo s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
$(QUIET)echo s=@TEST_OUTPUT_DIR@=$(CURDIR)/test/Output=g >> lit.tmp
$(QUIET)sed -f lit.tmp $< > $@
$(QUIET)-rm -f lit.tmp
-check:: $(PLUGIN) $(LIT_SITE_CONFIG)
- @echo "Running test suite"
+check-compilator:: $(PLUGIN) $(LIT_SITE_CONFIG)
+ @echo "Running test suite 'compilator'"
$(QUIET)$(LIT_DIR)/lit.py $(LIT_ARGS) --param site="$(LIT_SITE_CONFIG)" \
--config-prefix=dragonegg-lit $(TEST_SRC_DIR)/compilator
+check-correctness:: $(PLUGIN) $(LIT_SITE_CONFIG)
+ @echo "Running test suite 'correctness'"
+ $(QUIET)$(LIT_DIR)/lit.py $(LIT_ARGS) --param site="$(LIT_SITE_CONFIG)" \
+ --config-prefix=dragonegg-lit $(TEST_SRC_DIR)/correctness
+
+check:: check-correctness check-compilator
+
clean::
$(QUIET)rm -f *.o *.d $(PLUGIN) $(TARGET_UTIL) $(LIT_SITE_CONFIG)
Modified: dragonegg/trunk/test/README
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/README?rev=152944&r1=152943&r2=152944&view=diff
==============================================================================
--- dragonegg/trunk/test/README (original)
+++ dragonegg/trunk/test/README Fri Mar 16 15:55:19 2012
@@ -5,7 +5,8 @@
Every file found under the compilator directory is compiled by GCC both with and
without the DragonEgg plugin, at a variety of optimization levels. If GCC can
compile a file but DragonEgg cannot, or DragonEgg can compile the file but GCC
-cannot, then that test is considered to have failed.
+cannot, then that test is considered to have failed. Note that the generated
+code is *not* checked for correctness.
External source
---------------
@@ -26,3 +27,11 @@
For testing Java, consider having compilator/gcc-libjava be a symbolic link to
GCC's libjava.
+
+
+-----------------
+-- Correctness --
+-----------------
+
+The correctness directory contains tests that check the correctness of generated
+code.
Added: dragonegg/trunk/test/correctness/c/sv.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/correctness/c/sv.c?rev=152944&view=auto
==============================================================================
--- dragonegg/trunk/test/correctness/c/sv.c (added)
+++ dragonegg/trunk/test/correctness/c/sv.c Fri Mar 16 15:55:19 2012
@@ -0,0 +1,18 @@
+// RUN: %dragonegg -S %s -o - | FileCheck %s
+// Check that local variables are output in the order that they are declared in.
+
+void foo(int *);
+
+int bar(int x) {
+// CHECK: @bar
+ int a;
+// CHECK: %a = alloca
+ int b;
+// CHECK: %b = alloca
+ int c;
+// CHECK: %c = alloca
+ foo (&b);
+ foo (&c);
+ foo (&a);
+ return a + b + c;
+}
Added: dragonegg/trunk/test/correctness/dragonegg-lit.cfg
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/correctness/dragonegg-lit.cfg?rev=152944&view=auto
==============================================================================
--- dragonegg/trunk/test/correctness/dragonegg-lit.cfg (added)
+++ dragonegg/trunk/test/correctness/dragonegg-lit.cfg Fri Mar 16 15:55:19 2012
@@ -0,0 +1,53 @@
+# -*- Python -*-
+import os
+import platform
+import re
+import subprocess
+
+# name: The name of this test suite.
+config.name = 'Correctness'
+
+# Load common definitions.
+lit.load_config(config, lit.params['site'])
+
+# Tweak PATH for Win32
+if platform.system() == 'Windows':
+ # Seek sane tools in directories and set to $PATH.
+ path = getattr(config, 'lit_tools_dir', None)
+ path = lit.getToolsPath(path,
+ config.environment['PATH'],
+ ['cmp.exe', 'grep.exe', 'sed.exe'])
+ if path is not None:
+ path = os.path.pathsep.join((path,
+ config.environment['PATH']))
+ config.environment['PATH'] = path
+# Tweak the PATH to include the tools dir.
+path = os.path.pathsep.join((config.llvm_tools_dir, config.environment['PATH']))
+config.environment['PATH'] = path
+
+
+# testFormat: The test format to use to interpret tests.
+#
+# For now we require '&&' between commands, until they get globally killed and
+# the test runner updated.
+execute_external = (platform.system() != 'Windows'
+ or lit.getBashPath() not in [None, ""])
+config.test_format = lit.formats.ShTest(execute_external)
+
+# suffixes: A list of file extensions to treat as test files.
+config.suffixes = ['.ads', '.adb', '.c']
+
+# test_source_root: The root path where tests are located.
+config.test_source_root = os.path.dirname(__file__)
+
+# test_exec_root: The root path where tests should be run.
+config.test_exec_root = config.test_output_dir + '/correctness/'
+
+# When running under valgrind, we mangle '-vg' onto the end of the triple so we
+# can check it with XFAIL and XTARGET.
+if lit.useValgrind:
+ config.target_triple += '-vg'
+
+config.substitutions.append( ('%dragonegg', '%s -fplugin=%s '
+ '-fplugin-arg-dragonegg-emit-ir' %
+ (config.gcc_executable, config.dragonegg_plugin)))
Modified: dragonegg/trunk/test/dragonegg-lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/dragonegg-lit.site.cfg.in?rev=152944&r1=152943&r2=152944&view=diff
==============================================================================
--- dragonegg/trunk/test/dragonegg-lit.site.cfg.in (original)
+++ dragonegg/trunk/test/dragonegg-lit.site.cfg.in Fri Mar 16 15:55:19 2012
@@ -1,3 +1,6 @@
-config.gcc_executable = "@GCC@"
config.dragonegg_plugin = "@DRAGONEGG_PLUGIN@"
-config.test_output_dir = "@TEST_OUTPUT_DIR@"
+config.gcc_executable = "@GCC@"
+config.gcc_languages = "@GCC_LANGUAGES@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.target_triple = "@TARGET_TRIPLE@"
+config.test_output_dir = "@TEST_OUTPUT_DIR@"
More information about the llvm-commits
mailing list