@@ -958,18 +958,24 @@ def create_search_index_tasks():
958958
959959def create_perf_tasks ():
960960 tasks = []
961- for version , ssl , sync in product (["8.0" ], ["ssl" , "nossl" ], ["sync" , "async" ]):
961+ for version , ssl , sync in product (["8.0" ], ["ssl" , "nossl" ], ["sync" , "async" , "rust" ]):
962962 vars = dict (VERSION = f"v{ version } -perf" , SSL = ssl )
963963 server_func = FunctionCall (func = "run server" , vars = vars )
964- vars = dict (TEST_NAME = "perf" , SUB_TEST_NAME = sync )
965- test_func = FunctionCall (func = "run tests" , vars = vars )
964+ test_vars = dict (TEST_NAME = "perf" , SUB_TEST_NAME = sync )
965+ # Enable Rust for rust perf tests
966+ if sync == "rust" :
967+ test_vars ["PYMONGO_BUILD_RUST" ] = "1"
968+ test_vars ["PYMONGO_USE_RUST" ] = "1"
969+ test_func = FunctionCall (func = "run tests" , vars = test_vars )
966970 attach_func = FunctionCall (func = "attach benchmark test results" )
967971 send_func = FunctionCall (func = "send dashboard data" )
968972 task_name = f"perf-{ version } -standalone"
969973 if ssl == "ssl" :
970974 task_name += "-ssl"
971975 if sync == "async" :
972976 task_name += "-async"
977+ elif sync == "rust" :
978+ task_name += "-rust"
973979 tags = ["perf" ]
974980 commands = [server_func , test_func , attach_func , send_func ]
975981 tasks .append (EvgTask (name = task_name , tags = tags , commands = commands ))
@@ -1189,6 +1195,8 @@ def create_run_server_func():
11891195 "LOAD_BALANCER" ,
11901196 "LOCAL_ATLAS" ,
11911197 "NO_EXT" ,
1198+ "PYMONGO_BUILD_RUST" ,
1199+ "PYMONGO_USE_RUST" ,
11921200 ]
11931201 args = [".evergreen/just.sh" , "run-server" , "${TEST_NAME}" ]
11941202 sub_cmd = get_subprocess_exec (include_expansions_in_env = includes , args = args )
@@ -1222,6 +1230,8 @@ def create_run_tests_func():
12221230 "IS_WIN32" ,
12231231 "REQUIRE_FIPS" ,
12241232 "TEST_MIN_DEPS" ,
1233+ "PYMONGO_BUILD_RUST" ,
1234+ "PYMONGO_USE_RUST" ,
12251235 ]
12261236 args = [".evergreen/just.sh" , "setup-tests" , "${TEST_NAME}" , "${SUB_TEST_NAME}" ]
12271237 setup_cmd = get_subprocess_exec (include_expansions_in_env = includes , args = args )
@@ -1283,6 +1293,55 @@ def create_send_dashboard_data_func():
12831293 return "send dashboard data" , cmds
12841294
12851295
1296+ def create_rust_variants ():
1297+ """Create build variants that test with Rust extension alongside C extension."""
1298+ variants = []
1299+
1300+ # Test Rust on Linux (primary platform) - runs on PRs
1301+ # Run standard tests with Rust enabled (both sync and async)
1302+ variant = create_variant (
1303+ [".test-standard .server-latest .pr" ],
1304+ "Test with Rust Extension" ,
1305+ host = DEFAULT_HOST ,
1306+ tags = ["rust" , "pr" ],
1307+ expansions = dict (
1308+ PYMONGO_BUILD_RUST = "1" ,
1309+ PYMONGO_USE_RUST = "1" ,
1310+ ),
1311+ )
1312+ variants .append (variant )
1313+
1314+ # Test on macOS ARM64 (important for M1/M2 Macs)
1315+ variant = create_variant (
1316+ [".test-standard .server-latest !.pr" ],
1317+ "Test with Rust Extension - macOS ARM64" ,
1318+ host = HOSTS ["macos-arm64" ],
1319+ tags = ["rust" ],
1320+ batchtime = BATCHTIME_WEEK ,
1321+ expansions = dict (
1322+ PYMONGO_BUILD_RUST = "1" ,
1323+ PYMONGO_USE_RUST = "1" ,
1324+ ),
1325+ )
1326+ variants .append (variant )
1327+
1328+ # Test on Windows (important for cross-platform compatibility)
1329+ variant = create_variant (
1330+ [".test-standard .server-latest !.pr" ],
1331+ "Test with Rust Extension - Windows" ,
1332+ host = HOSTS ["win64" ],
1333+ tags = ["rust" ],
1334+ batchtime = BATCHTIME_WEEK ,
1335+ expansions = dict (
1336+ PYMONGO_BUILD_RUST = "1" ,
1337+ PYMONGO_USE_RUST = "1" ,
1338+ ),
1339+ )
1340+ variants .append (variant )
1341+
1342+ return variants
1343+
1344+
12861345mod = sys .modules [__name__ ]
12871346write_variants_to_file (mod )
12881347write_tasks_to_file (mod )
0 commit comments