arichardson updated this revision to Diff 243859. arichardson added a comment. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Move tests to clang/ instead Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74051/new/ https://reviews.llvm.org/D74051 Files: clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected clang/test/utils/update_cc_test_checks/def-and-decl.test clang/test/utils/update_cc_test_checks/lit.local.cfg clang/test/utils/update_cc_test_checks/mangled_names.test llvm/test/tools/UpdateTestChecks/lit.local.cfg llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test
Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg =================================================================== --- llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# These tests require clang. -if 'clang-binary' not in config.available_features: - config.unsupported = True Index: llvm/test/tools/UpdateTestChecks/lit.local.cfg =================================================================== --- llvm/test/tools/UpdateTestChecks/lit.local.cfg +++ llvm/test/tools/UpdateTestChecks/lit.local.cfg @@ -42,11 +42,3 @@ config.available_features.add('llvm-mca-binary') mca_arg = '--llvm-mca-binary ' + shell_quote(llvm_mca_path) add_update_script_substition('%update_test_checks', extra_args=mca_arg) - -clang_path = os.path.join(config.llvm_tools_dir, 'clang') -if os.path.isfile(clang_path): - config.available_features.add('clang-binary') - extra_args = '--clang ' + shell_quote(clang_path) - if os.path.isfile(opt_path): - extra_args += ' --opt ' + shell_quote(opt_path) - add_update_script_substition('%update_cc_test_checks', extra_args=extra_args) Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test =================================================================== --- /dev/null +++ llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test @@ -1,13 +0,0 @@ -## Basic test checking that update_cc_test_checks.py works as expected for -## functions with mangled names -# RUN: cp -f %S/Inputs/mangled_names.c %t.c && %update_cc_test_checks -v %t.c -# RUN: diff -u %t.c %S/Inputs/mangled_names.c.expected -## Check that running the script again does not change the result: -# RUN: %update_cc_test_checks -v %t.c -# RUN: diff -u %t.c %S/Inputs/mangled_names.c.expected -## Also try the --function-signature flag -# RUN: %update_cc_test_checks %t.c --function-signature -# RUN: diff -u %t.c %S/Inputs/mangled_names.c.funcsig.expected -## Verify that running without the --function-signature flag removes the -SAME: lines: -# RUN: %update_cc_test_checks %t.c -# RUN: diff -u %t.c %S/Inputs/mangled_names.c.expected Index: clang/test/utils/update_cc_test_checks/lit.local.cfg =================================================================== --- /dev/null +++ clang/test/utils/update_cc_test_checks/lit.local.cfg @@ -0,0 +1,25 @@ +import os + +import lit.util + +# python 2.7 backwards compatibility +try: + from shlex import quote as shell_quote +except ImportError: + from pipes import quote as shell_quote + + +config.test_format = lit.formats.ShTest(execute_external=False) +config.suffixes = ['.test'] + +clang_path = os.path.join(config.clang_tools_dir, 'clang') +extra_args = '--clang ' + shell_quote(clang_path) +opt_path = os.path.join(config.llvm_tools_dir, 'opt') +extra_args += ' --opt ' + shell_quote(opt_path) +script_path = os.path.join(config.llvm_src_root, 'utils', + 'update_cc_test_checks.py') +assert os.path.isfile(script_path) +config.substitutions.append( + ('%update_cc_test_checks', "%s %s %s" % ( + shell_quote(config.python_executable), shell_quote(script_path), + extra_args))) Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test =================================================================== --- /dev/null +++ llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test @@ -1,7 +0,0 @@ -## Test that CHECK lines are generated before the definion and not the declaration - -# RUN: cp %S/Inputs/def-and-decl.c %t.c && %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/def-and-decl.c.expected %t.c -## Check that re-running update_cc_test_checks doesn't change the output -# RUN: %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/def-and-decl.c.expected %t.c Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected =================================================================== --- /dev/null +++ llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected @@ -1,43 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// Example input for update_cc_test_checks -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s - -// CHECK-LABEL: define {{[^@]+}}@test -// CHECK-SAME: (i64 [[A:%.*]], i32 [[B:%.*]]) #0 -// CHECK-NEXT: entry: -// CHECK-NEXT: [[A_ADDR:%.*]] = alloca i64, align 8 -// CHECK-NEXT: [[B_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store i64 [[A]], i64* [[A_ADDR]], align 8 -// CHECK-NEXT: store i32 [[B]], i32* [[B_ADDR]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* [[A_ADDR]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[B_ADDR]], align 4 -// CHECK-NEXT: [[CONV:%.*]] = sext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] -// CHECK-NEXT: ret i64 [[ADD]] -// -long test(long a, int b) { - return a + b; -} - -// A function with a mangled name -// CHECK-LABEL: define {{[^@]+}}@_Z4testlii -// CHECK-SAME: (i64 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]]) #0 -// CHECK-NEXT: entry: -// CHECK-NEXT: [[A_ADDR:%.*]] = alloca i64, align 8 -// CHECK-NEXT: [[B_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: [[C_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store i64 [[A]], i64* [[A_ADDR]], align 8 -// CHECK-NEXT: store i32 [[B]], i32* [[B_ADDR]], align 4 -// CHECK-NEXT: store i32 [[C]], i32* [[C_ADDR]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* [[A_ADDR]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[B_ADDR]], align 4 -// CHECK-NEXT: [[CONV:%.*]] = sext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] -// CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[C_ADDR]], align 4 -// CHECK-NEXT: [[CONV1:%.*]] = sext i32 [[TMP2]] to i64 -// CHECK-NEXT: [[ADD2:%.*]] = add nsw i64 [[ADD]], [[CONV1]] -// CHECK-NEXT: ret i64 [[ADD2]] -// -__attribute__((overloadable)) long test(long a, int b, int c) { - return a + b + c; -} Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected =================================================================== --- /dev/null +++ llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected @@ -1,41 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// Example input for update_cc_test_checks -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s - -// CHECK-LABEL: @test( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[A_ADDR:%.*]] = alloca i64, align 8 -// CHECK-NEXT: [[B_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store i64 [[A:%.*]], i64* [[A_ADDR]], align 8 -// CHECK-NEXT: store i32 [[B:%.*]], i32* [[B_ADDR]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* [[A_ADDR]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[B_ADDR]], align 4 -// CHECK-NEXT: [[CONV:%.*]] = sext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] -// CHECK-NEXT: ret i64 [[ADD]] -// -long test(long a, int b) { - return a + b; -} - -// A function with a mangled name -// CHECK-LABEL: @_Z4testlii( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[A_ADDR:%.*]] = alloca i64, align 8 -// CHECK-NEXT: [[B_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: [[C_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store i64 [[A:%.*]], i64* [[A_ADDR]], align 8 -// CHECK-NEXT: store i32 [[B:%.*]], i32* [[B_ADDR]], align 4 -// CHECK-NEXT: store i32 [[C:%.*]], i32* [[C_ADDR]], align 4 -// CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* [[A_ADDR]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[B_ADDR]], align 4 -// CHECK-NEXT: [[CONV:%.*]] = sext i32 [[TMP1]] to i64 -// CHECK-NEXT: [[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] -// CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[C_ADDR]], align 4 -// CHECK-NEXT: [[CONV1:%.*]] = sext i32 [[TMP2]] to i64 -// CHECK-NEXT: [[ADD2:%.*]] = add nsw i64 [[ADD]], [[CONV1]] -// CHECK-NEXT: ret i64 [[ADD2]] -// -__attribute__((overloadable)) long test(long a, int b, int c) { - return a + b + c; -} Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c =================================================================== --- /dev/null +++ llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c @@ -1,11 +0,0 @@ -// Example input for update_cc_test_checks -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s - -long test(long a, int b) { - return a + b; -} - -// A function with a mangled name -__attribute__((overloadable)) long test(long a, int b, int c) { - return a + b + c; -} Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected =================================================================== --- /dev/null +++ llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected @@ -1,34 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// Check that the CHECK lines are generated before the definition and not the declaration -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s - -int foo(); - -void empty_function(); - -// CHECK-LABEL: @main( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store i32 0, i32* [[RETVAL]], align 4 -// CHECK-NEXT: call void @empty_function() -// CHECK-NEXT: [[CALL:%.*]] = call i32 @foo() -// CHECK-NEXT: ret i32 [[CALL]] -// -int main() { - empty_function(); - return foo(); -} - -// CHECK-LABEL: @foo( -// CHECK-NEXT: entry: -// CHECK-NEXT: ret i32 1 -// -int foo() { - return 1; -} - -// CHECK-LABEL: @empty_function( -// CHECK-NEXT: entry: -// CHECK-NEXT: ret void -// -void empty_function() {} Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c =================================================================== --- /dev/null +++ llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c @@ -1,17 +0,0 @@ -// Check that the CHECK lines are generated before the definition and not the declaration -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s - -int foo(); - -void empty_function(); - -int main() { - empty_function(); - return foo(); -} - -int foo() { - return 1; -} - -void empty_function() {}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits