Skip to content

Commit 1f09a00

Browse files
authored
Merge pull request #1491 from NVIDIA/fix-spawn-future-test
fix a bad test for `async_scope::spawn_future`
2 parents c7ae38c + e46f8ae commit 1f09a00

5 files changed

Lines changed: 45 additions & 39 deletions

File tree

.vscode/launch.json

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,61 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "C++ Tests (lldb)",
9-
"type": "lldb",
8+
"name": "C++ Current Target (lldb-dap)",
9+
"type": "lldb-dap",
1010
"request": "launch",
11-
"stdio": null,
1211
"stopOnEntry": false,
13-
"terminal": "console",
14-
"console": "internalConsole",
15-
"sourceLanguages": ["cpp", "cuda"],
16-
"internalConsoleOptions": "neverOpen",
12+
"internalConsoleOptions": "openOnFirstSessionStart",
13+
"cwd": "${command:cmake.launchTargetDirectory}",
14+
"program": "${command:cmake.launchTargetPath}",
15+
"initCommands": [
16+
"settings set target.disable-aslr false"
17+
],
18+
"args": "${input:CXX_PROGRAM_ARGS}",
19+
},
20+
{
21+
"name": "C++ Tests (lldb-dap)",
22+
"type": "lldb-dap",
23+
"request": "launch",
24+
"stopOnEntry": false,
25+
"internalConsoleOptions": "openOnFirstSessionStart",
1726
"cwd": "${command:cmake.buildDirectory}",
18-
"relativePathBase": "${command:cmake.buildDirectory}",
1927
"program": "${command:cmake.buildDirectory}/${input:CXX_TEST_SUITE}",
20-
"initCommands": ["settings set target.disable-aslr false"],
21-
"args": ["-v", "normal", "${input:CXX_TEST_TAGS}"],
28+
"initCommands": [
29+
"settings set target.disable-aslr false"
30+
],
31+
"args": [
32+
"-v",
33+
"normal",
34+
"${input:CXX_TEST_TAGS}"
35+
],
2236
},
2337
{
24-
"name": "CUDA Tests (cuda-gdb)",
38+
"name": "CUDA Current Target (cuda-gdb)",
2539
"type": "cuda-gdb",
2640
"request": "launch",
2741
"stopAtEntry": false,
2842
"breakOnLaunch": false,
29-
"internalConsoleOptions": "neverOpen",
30-
"program": "${command:cmake.buildDirectory}/${input:CUDA_TEST_SUITE}",
31-
"cwd": "${command:cmake.buildDirectory}",
32-
"args": "-v normal ${input:CUDA_TEST_TAGS}",
33-
},
34-
{
35-
"name": "C++ Current Target (lldb)",
36-
"type": "lldb",
37-
"request": "launch",
38-
"stdio": null,
39-
"stopOnEntry": false,
40-
"terminal": "console",
41-
"console": "internalConsole",
42-
"sourceLanguages": ["cpp", "cuda"],
43-
"internalConsoleOptions": "neverOpen",
44-
"cwd": "${command:cmake.launchTargetDirectory}",
45-
"relativePathBase": "${command:cmake.launchTargetDirectory}",
43+
"internalConsoleOptions": "openOnFirstSessionStart",
4644
"program": "${command:cmake.launchTargetPath}",
47-
"initCommands": ["settings set target.disable-aslr false"],
45+
"cwd": "${command:cmake.launchTargetDirectory}",
4846
"args": "${input:CXX_PROGRAM_ARGS}",
4947
},
5048
{
51-
"name": "CUDA Current Target (cuda-gdb)",
49+
"name": "CUDA Tests (cuda-gdb)",
5250
"type": "cuda-gdb",
5351
"request": "launch",
5452
"stopAtEntry": false,
5553
"breakOnLaunch": false,
56-
"internalConsoleOptions": "neverOpen",
57-
"program": "${command:cmake.launchTargetPath}",
58-
"cwd": "${command:cmake.launchTargetDirectory}",
59-
"args": "${input:CXX_PROGRAM_ARGS}",
54+
"internalConsoleOptions": "openOnSessionStart",
55+
"program": "${command:cmake.buildDirectory}/${input:CUDA_TEST_SUITE}",
56+
"cwd": "${command:cmake.buildDirectory}",
57+
"args": "-v normal ${input:CUDA_TEST_TAGS}",
6058
},
6159
],
6260
"inputs": [
61+
// These require the Tasks Shell Input extension:
62+
// https://marketplace.visualstudio.com/items?itemName=augustocdias.tasks-shell-input
6363
{
6464
"id": "CXX_PROGRAM_ARGS",
6565
"type": "promptString",
@@ -109,4 +109,4 @@
109109
}
110110
},
111111
],
112-
}
112+
}

include/exec/just_from.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ namespace exec {
5959
template <class... Ts>
6060
requires stdexec::__sigs::__is_compl_sig<_set_tag_t(Ts...)>
6161
auto operator()(Ts&&... ts) const noexcept //
62-
-> stdexec::completion_signatures<_set_tag_t(Ts...)>;
62+
-> stdexec::completion_signatures<_set_tag_t(Ts...)> {
63+
return {};
64+
}
6365
};
6466

6567
template <class Rcvr>

include/stdexec/__detail/__starts_on.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace stdexec {
3737
struct __always {
3838
_Ty __val_;
3939

40-
auto operator()() noexcept -> _Ty {
40+
STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()() noexcept(__nothrow_constructible_from<_Ty, _Ty>) -> _Ty {
4141
return static_cast<_Ty&&>(__val_);
4242
}
4343
};

include/stdexec/__detail/__tuple.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ namespace stdexec {
4646

4747
template <class _Ty>
4848
concept __empty = //
49-
STDEXEC_IS_EMPTY(_Ty) && STDEXEC_IS_TRIVIALLY_CONSTRUCTIBLE(_Ty);
49+
STDEXEC_IS_EMPTY(_Ty) && STDEXEC_IS_TRIVIALLY_CONSTRUCTIBLE(_Ty)
50+
&& STDEXEC_IS_TRIVIALLY_COPYABLE(_Ty);
5051

5152
template <__empty _Ty>
5253
inline _Ty __value{};

test/exec/async_scope/test_spawn_future.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <catch2/catch.hpp>
22
#include <exec/async_scope.hpp>
33
#include <exec/env.hpp>
4+
#include <exec/just_from.hpp>
45
#include <exec/static_thread_pool.hpp>
56
#include "test_common/schedulers.hpp"
67
#include "test_common/receivers.hpp"
@@ -148,7 +149,9 @@ namespace {
148149
};
149150

150151
ex::sender auto snd =
151-
scope.spawn_future(ex::starts_on(pool.get_scheduler(), ex::just(throwing_copy())));
152+
scope.spawn_future(ex::starts_on(pool.get_scheduler(), exec::just_from([](auto sink) {
153+
return sink(throwing_copy());
154+
})));
152155
try {
153156
sync_wait(std::move(snd));
154157
FAIL("Exceptions should have been thrown");

0 commit comments

Comments
 (0)