Skip to content

Commit

Permalink
[SYCL] add overlooked default context test . (#12728)
Browse files Browse the repository at this point in the history
despite having a unit test for default context, realized there is not
one to affirm the new default configuration.
  • Loading branch information
cperkinsintel authored Feb 16, 2024
1 parent 0c74e16 commit 79d775e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions sycl/test-e2e/Config/default-context.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// RUN: env SYCL_ENABLE_DEFAULT_CONTEXTS=1 %t.out
// RUN: env SYCL_ENABLE_DEFAULT_CONTEXTS=0 %t.out 1

#include <sycl/sycl.hpp>

// when not using the environment variable, we use the "default context" on both
// Lin and Win. This test asserts it defaults correctly, and that the
// environment variable is working as expected.

// no args: YES default context.
// any arg: NO default context.
int main(int argc, char *argv[]) {
sycl::queue q1;
sycl::queue q2;

if (argc <= 1)
assert(q1.get_context() == q2.get_context());
else
assert(q1.get_context() != q2.get_context());
}

0 comments on commit 79d775e

Please sign in to comment.