File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -448,3 +448,34 @@ TEST(InterpreterTest, MultipleInterpreter) {
448
448
std::string cerrs = testing::internal::GetCapturedStderr ();
449
449
EXPECT_STREQ (cerrs.c_str (), " printf_jit called!\n " );
450
450
}
451
+
452
+ TEST (InterpreterTest, ASMParsing) {
453
+ #ifdef EMSCRIPTEN
454
+ GTEST_SKIP () << " Test fails for Emscipten builds" ;
455
+ #endif
456
+ #ifdef _WIN32
457
+ GTEST_SKIP () << " Disabled on Windows. Needs fixing." ;
458
+ #endif
459
+ #if (defined(_M_ARM) || defined(_M_ARM64))
460
+ GTEST_SKIP () << " Skipped on ARM, we test ASM for x86_64" ;
461
+ #endif
462
+
463
+ if (llvm::sys::RunningOnValgrind ())
464
+ GTEST_SKIP () << " XFAIL due to Valgrind report" ;
465
+ std::vector<const char *> interpreter_args = {" -include" , " new" };
466
+ auto * I = Cpp::CreateInterpreter (interpreter_args);
467
+ EXPECT_TRUE (I);
468
+
469
+ EXPECT_TRUE (Cpp::Declare (R"(
470
+ #include <iostream>
471
+ void foo(int &input) {
472
+ __asm__ volatile ("addl $10, %0" : "+r"(input));
473
+ }
474
+ )" ,
475
+ I) == 0 );
476
+
477
+ bool hasError;
478
+ EXPECT_TRUE (Cpp::Process (" int b = 42; foo(b);" ) == 0 );
479
+ EXPECT_TRUE (Cpp::Evaluate (" b" , &hasError) == 52 );
480
+ EXPECT_FALSE (hasError);
481
+ }
You can’t perform that action at this time.
0 commit comments