Skip to content

Conversation

@ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Apr 10, 2025

Tests should avoid using platform dependent behavior, like /dev/null
when possible. -fdriver-only should stop clang even earlier, and avoid
any non-diagnostic output.

Tests should avoid using platform dependent behavior, like /dev/null
when possible. -fdriver-only should stop clang even earlier, and avoid
any non-diagnostic output.
Copy link
Contributor Author

ilovepi commented Apr 10, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ilovepi ilovepi marked this pull request as ready for review April 10, 2025 20:52
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Apr 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 10, 2025

@llvm/pr-subscribers-clang

Author: Paul Kirth (ilovepi)

Changes

Tests should avoid using platform dependent behavior, like /dev/null
when possible. -fdriver-only should stop clang even earlier, and avoid
any non-diagnostic output.


Full diff: https://github.com/llvm/llvm-project/pull/135255.diff

1 Files Affected:

  • (modified) clang/test/Driver/openacc-no-cir.c (+3-3)
diff --git a/clang/test/Driver/openacc-no-cir.c b/clang/test/Driver/openacc-no-cir.c
index 891f175a001bb..5fa1e4e0c809f 100644
--- a/clang/test/Driver/openacc-no-cir.c
+++ b/clang/test/Driver/openacc-no-cir.c
@@ -1,6 +1,6 @@
-// RUN: %clang -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=ERROR
-// RUN: %clang -fclangir -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
-// RUN: %clang -fopenacc -fclangir -S %s -o /dev/null 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
+// RUN: %clang -fopenacc -S %s -o -fdriver-only 2>&1 | FileCheck %s -check-prefix=ERROR
+// RUN: %clang -fclangir -fopenacc -S %s -fdriver-only 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
+// RUN: %clang -fopenacc -fclangir -S %s -fdriver-only 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
 
 // ERROR: OpenACC directives will result in no runtime behavior; use -fclangir to enable runtime effect
 // NOERROR-NOT: OpenACC directives

@llvmbot
Copy link
Member

llvmbot commented Apr 10, 2025

@llvm/pr-subscribers-clang-driver

Author: Paul Kirth (ilovepi)

Changes

Tests should avoid using platform dependent behavior, like /dev/null
when possible. -fdriver-only should stop clang even earlier, and avoid
any non-diagnostic output.


Full diff: https://github.com/llvm/llvm-project/pull/135255.diff

1 Files Affected:

  • (modified) clang/test/Driver/openacc-no-cir.c (+3-3)
diff --git a/clang/test/Driver/openacc-no-cir.c b/clang/test/Driver/openacc-no-cir.c
index 891f175a001bb..5fa1e4e0c809f 100644
--- a/clang/test/Driver/openacc-no-cir.c
+++ b/clang/test/Driver/openacc-no-cir.c
@@ -1,6 +1,6 @@
-// RUN: %clang -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=ERROR
-// RUN: %clang -fclangir -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
-// RUN: %clang -fopenacc -fclangir -S %s -o /dev/null 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
+// RUN: %clang -fopenacc -S %s -o -fdriver-only 2>&1 | FileCheck %s -check-prefix=ERROR
+// RUN: %clang -fclangir -fopenacc -S %s -fdriver-only 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
+// RUN: %clang -fopenacc -fclangir -S %s -fdriver-only 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
 
 // ERROR: OpenACC directives will result in no runtime behavior; use -fclangir to enable runtime effect
 // NOERROR-NOT: OpenACC directives

Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one shouldn't work. We explicitly don't diagnose this in non-codegen invocations.

// RUN: %clang -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=ERROR
// RUN: %clang -fclangir -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
// RUN: %clang -fopenacc -fclangir -S %s -o /dev/null 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR
// RUN: %clang -fopenacc -S %s -o -fdriver-only 2>&1 | FileCheck %s -check-prefix=ERROR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-o -fdriver-only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, probably why the test passed 🤦

@MaskRay
Copy link
Member

MaskRay commented Apr 11, 2025

/dev/null works on Windows

utils/lit/lit/TestRunner.py
55:# Use temporary files to replace /dev/null on Windows.
57:kDevNull = "/dev/null"

If you are adjusting the test, also insert error: prefix for error messages

@ilovepi
Copy link
Contributor Author

ilovepi commented Apr 11, 2025

This one shouldn't work. We explicitly don't diagnose this in non-codegen invocations.

That's surprising, but if that's the case, I don't think this patch makes much sense.

@ilovepi ilovepi closed this Apr 11, 2025
@ilovepi ilovepi deleted the users/ilovepi/clang-driver-only branch April 11, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants