diff options
Diffstat (limited to 'openmp/testsuite/bin')
-rw-r--r-- | openmp/testsuite/bin/Makefile | 23 | ||||
-rwxr-xr-x | openmp/testsuite/bin/distribute.sh | 125 | ||||
-rw-r--r-- | openmp/testsuite/bin/header | 6 | ||||
-rw-r--r-- | openmp/testsuite/bin/lit.cfg | 78 | ||||
-rw-r--r-- | openmp/testsuite/bin/lit.site.cfg.in | 30 | ||||
-rw-r--r-- | openmp/testsuite/bin/lit.tmp | 1 |
6 files changed, 263 insertions, 0 deletions
diff --git a/openmp/testsuite/bin/Makefile b/openmp/testsuite/bin/Makefile new file mode 100644 index 00000000000..1dbd3baf8b6 --- /dev/null +++ b/openmp/testsuite/bin/Makefile @@ -0,0 +1,23 @@ +CC = clang +CFLAGS = -fopenmp -S -emit-llvm +INCL = +LIBS = + +BIN = +SRC_DIR = ./c +SRC_FILES := $(foreach DIR, $(SRC_DIR), $(wildcard $(SRC_DIR)/*.c)) +OBJS := $(patsubst %.c, %.o, $(SRC_FILES)) +TARGETLIST := $(patsubst %.c, %, $(SRC_FILES)) + +all:$(TARGETLIST) + ./distribute.sh + @ echo all done + +.PHONY: clean + +$(TARGETLIST): $(SRC_FILES) + $(CC) $(CFLAGS) $(LIBS) $(INCL) $@.c -o $@.ll + +clean: + @ rm -rf c/* + @ echo clean bin done diff --git a/openmp/testsuite/bin/distribute.sh b/openmp/testsuite/bin/distribute.sh new file mode 100755 index 00000000000..dbb0f5f007c --- /dev/null +++ b/openmp/testsuite/bin/distribute.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +# add header for .ll files + +# get tmp header +cp header /tmp/tmp.header +echo >> /tmp/tmp.header + +# create temporary test package +mkdir c-$MACHTYPE$OSTYPE +`cp c/*.ll c-$MACHTYPE$OSTYPE/` + +# add new header into .ll files +for file in c-$MACHTYPE$OSTYPE/* +do + cp $file /tmp/tmp.ll.bf + cat /tmp/tmp.header /tmp/tmp.ll.bf > /tmp/tmp.ll + mv /tmp/tmp.ll $file +done + + +# in bin/, target is ../LLVM-IR/ARCH/OS +LEVEL=../LLVM-IR/ +ARCH_PATH=../LLVM-IR/ +OS_PATH=../LLVM-IR/ + +# for linux system, add your arch and os here +declare -a ARCHes=(x86 x86_64 powerpc arm mips darwin) +declare -a OSes=(linux macosx windows darwin) + +declare lowerARCH +declare lowerOS + +# target directory name +declare upperARCH +declare upperOS + +lowerARCH=$(echo "$MACHTYPE" | tr '[:upper:]' '[:lower:]') +lowerOS=$(echo "$OSTYPE" | tr '[:upper:]' '[:lower:]') + +# ARCH +for i in ${ARCHes[@]} +do + result=$(echo "${lowerARCH}" | grep $i) + if [[ "$result" != "" ]] + then + # upperARCH=$i + upperARCH=$(echo "$i" | tr '[:lower:]' '[:upper:]') + fi +done + +if [[ "$upperARCH" == "" ]] +then + echo "Not found ${lowerARCH} in the [${ARCHes[@]}]!" + exit +fi + +# OS +for i in ${OSes[@]} +do + result=$(echo "${lowerOS}" | grep $i) + if [[ "$result" != "" ]] + then + # upperOS=$i + upperOS=$(echo "$i" | tr '[:lower:]' '[:upper:]') + fi +done + +if [[ "$upperOS" == "" ]] +then + echo "Not found ${lowerOS} in the [${OSes[@]}]!" + exit +fi + +# survived, assemble the path +# ARCH_PATH+=$upperARCH/ +# OS_PATH+=$upperARCH/$upperOS/ +ARCH_newFormat=. +if [ $upperARCH = "X86" ]; then + ARCH_newFormat=32 +else + ARCH_newFormat=32e +fi +OS_newFormat=. +if [ $upperOS = "LINUX" ]; then + OS_newFormat=lin +elif [ $upperOS = "MACOSX" ]; then + OS_newFormat=mac +elif [ $upperOS = "WINDOWS" ]; then + OS_newFormat=win +elif [ $upperOS = "DARWIN" ]; then + OS_newFormat=dar +else + OS_newFormat=unknown +fi +OS_PATH+=$OS_newFormat"_"$ARCH_newFormat + +# test and create directory +if [ ! -d "$LEVEL" ]; then + mkdir $LEVEL + mkdir $OS_PATH +else + if [ ! -d "$OS_PATH" ]; then + mkdir $OS_PATH + fi +fi + +# reserve the tmp path to LLVM-IR/ARCH/OS +echo $OS_PATH"/" > lit.tmp + +# OS_ARCH=$OS_newFormat"_"$ARCH_newFormat +# echo -e "if not '$OS_ARCH' in config.root.targets:" > $OS_PATH'/'lit.local.cfg +# echo -e "\tconfig.unsupported = True" >> $OS_PATH'/'lit.local.cfg + +# copy *.ll files to ARCH/OS +`cp lit.* $LEVEL` + +# omit orph test +`rm c-$MACHTYPE$OSTYPE/ctest_*.ll` +`rm c-$MACHTYPE$OSTYPE/orph_ctest_*.ll` +`cp c-$MACHTYPE$OSTYPE/*.ll $OS_PATH` + +# clean +`rm /tmp/tmp.*` +rm -rf c-$MACHTYPE$OSTYPE/ diff --git a/openmp/testsuite/bin/header b/openmp/testsuite/bin/header new file mode 100644 index 00000000000..7cc6c7dea28 --- /dev/null +++ b/openmp/testsuite/bin/header @@ -0,0 +1,6 @@ +; RUN: %clang -liomp5 -lm %s -o %t && %t 2>&1 | FileCheck %s +; CHECK-NOT: Test failed +; CHECK: Directive worked without errors + + + diff --git a/openmp/testsuite/bin/lit.cfg b/openmp/testsuite/bin/lit.cfg new file mode 100644 index 00000000000..195781989e5 --- /dev/null +++ b/openmp/testsuite/bin/lit.cfg @@ -0,0 +1,78 @@ +# -*- Python -*- + +# Configuration file for the 'lit' test runner. + +import os +import sys +import re +import platform + +try: + import lit.util + import lit.formats +except ImportError: + pass + +# name: The name of this test suite. +config.name = 'OpenMPValidationSuite' + +# testFormat: The test format to use to interpret tests. +config.test_format = lit.formats.ShTest(execute_external=False) + +# suffixes: A list of file extensions to treat as test files +# Note this can be overridden by lit.local.cfg files +config.suffixes = ['.ll'] + +# test_source_root: The root path where tests are located. +#config.test_source_root = "/home/ichoyjx/install/openmp/testsuite/bin" +#os.path.dirname(__file__) + +# test_exec_root: The root path where tests should be run. +#mpvs_obj_root = getattr(config, 'mpvs_obj_root', None) +#if mpvs_obj_root is not None: +config.test_exec_root = "./" +#os.path.join(mpvs_obj_root, 'src') + +# Discover the 'clang' and 'clangcc' to use. + +import os + +def inferClang(PATH): + # Determine which clang to use. + clang = os.getenv('CLANG') + + # If the user set clang in the environment, definitely use that and don't + # try to validate. + if clang: + return clang + + # Otherwise look in the path. + clang = lit.util.which('clang', PATH) + + if not clang: + lit_config.fatal("couldn't find 'clang' program, try setting " + "CLANG in your environment") + + return clang + +config.clang = inferClang(config.environment['PATH']).replace('\\', '/') +config.substitutions.append( ('%clang', ' ' + config.clang + ' ') ) + +# Propogate some environment variable to test environment. +def addEnv(name): + if name in os.environ: + config.environment[name] = os.environ[name] + +addEnv('HOME') +addEnv('PWD') + + +addEnv('C_INCLUDE_PATH') +addEnv('CPLUS_INCLUDE_PATH') +addEnv('LIBRARY_PATH') +addEnv('LD_LIBRARY_PATH') +addEnv('DYLD_LIBRARY_PATH') + +# Check that the object root is known. +if config.test_exec_root is None: + lit.fatal('test execution root not set!') diff --git a/openmp/testsuite/bin/lit.site.cfg.in b/openmp/testsuite/bin/lit.site.cfg.in new file mode 100644 index 00000000000..11866d4dd58 --- /dev/null +++ b/openmp/testsuite/bin/lit.site.cfg.in @@ -0,0 +1,30 @@ +## Autogenerated by LLVM/Clang configuration. +#config.mpvs_src_root = "/home/ichoyjx/install/openmp/testsuite/bin/c" +config.mpvs_obj_root = "/tmp" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" + + +# Needed to check if a hack needs to be applied +config.llvm_version_major = "@LLVM_VERSION_MAJOR@" + +# Compilers +# FIXME: use llvmcc not llvmgcc +config.llvmclang = "clang" + +# Features +config.enable_uclibc = True if @ENABLE_UCLIBC@ == 1 else False +config.enable_posix_runtime = True if @ENABLE_POSIX_RUNTIME@ == 1 else False +config.have_selinux = True if @HAVE_SELINUX@ == 1 else False + +# Current target +config.target_triple = "@TARGET_TRIPLE@" + +# Let the main config do the real work. +try: + lit +except NameError: + # Use lit_config class + lit_config.load_config(config, "@MPVS_SOURCE_DIR@/lit.cfg") +else: + # Use old lit class + lit.load_config(config, "@MPVS_SOURCE_DIR@/lit.cfg") diff --git a/openmp/testsuite/bin/lit.tmp b/openmp/testsuite/bin/lit.tmp new file mode 100644 index 00000000000..81d30fb0a4e --- /dev/null +++ b/openmp/testsuite/bin/lit.tmp @@ -0,0 +1 @@ +../LLVM-IR/lin_32e/ |