diff options
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index d37848bdef..ecff3a9ebd 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -2544,6 +2544,10 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2544 | self.assertEqual(status, 0, msg="%s failed: %s" % (ptest_cmd, output)) | 2544 | self.assertEqual(status, 0, msg="%s failed: %s" % (ptest_cmd, output)) |
2545 | self.assertIn("PASS: cpp-example-lib", output) | 2545 | self.assertIn("PASS: cpp-example-lib", output) |
2546 | 2546 | ||
2547 | # Verify remote debugging works | ||
2548 | self._gdb_cross_debugging( | ||
2549 | qemu, recipe_name, example_exe, MAGIC_STRING_ORIG) | ||
2550 | |||
2547 | # Replace the Magic String in the code, compile and deploy to Qemu | 2551 | # Replace the Magic String in the code, compile and deploy to Qemu |
2548 | cpp_example_lib_hpp = os.path.join(tempdir, 'cpp-example-lib.hpp') | 2552 | cpp_example_lib_hpp = os.path.join(tempdir, 'cpp-example-lib.hpp') |
2549 | with open(cpp_example_lib_hpp, 'r') as file: | 2553 | with open(cpp_example_lib_hpp, 'r') as file: |
@@ -2565,6 +2569,10 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2565 | self.assertEqual(status, 0, msg="%s failed: %s" % (ptest_cmd, output)) | 2569 | self.assertEqual(status, 0, msg="%s failed: %s" % (ptest_cmd, output)) |
2566 | self.assertIn("PASS: cpp-example-lib", output) | 2570 | self.assertIn("PASS: cpp-example-lib", output) |
2567 | 2571 | ||
2572 | # Verify remote debugging works wit the modified magic string | ||
2573 | self._gdb_cross_debugging( | ||
2574 | qemu, recipe_name, example_exe, MAGIC_STRING_NEW) | ||
2575 | |||
2568 | def _gdb_cross(self): | 2576 | def _gdb_cross(self): |
2569 | """Verify gdb-cross is provided by devtool ide-sdk""" | 2577 | """Verify gdb-cross is provided by devtool ide-sdk""" |
2570 | target_arch = self.td["TARGET_ARCH"] | 2578 | target_arch = self.td["TARGET_ARCH"] |
@@ -2578,13 +2586,22 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2578 | self.assertEqual(r.status, 0) | 2586 | self.assertEqual(r.status, 0) |
2579 | self.assertIn("GNU gdb", r.output) | 2587 | self.assertIn("GNU gdb", r.output) |
2580 | 2588 | ||
2581 | def _gdb_cross_debugging(self, qemu, recipe_name, example_exe): | 2589 | def _gdb_cross_debugging(self, qemu, recipe_name, example_exe, magic_string): |
2582 | """Verify gdb-cross is working | 2590 | """Verify gdb-cross is working |
2583 | 2591 | ||
2584 | Test remote debugging: | 2592 | Test remote debugging: |
2585 | break main | 2593 | break main |
2586 | run | 2594 | run |
2587 | continue | 2595 | continue |
2596 | break CppExample::print_json() | ||
2597 | continue | ||
2598 | print CppExample::test_string.compare("cpp-example-lib Magic: 123456789") | ||
2599 | $1 = 0 | ||
2600 | print CppExample::test_string.compare("cpp-example-lib Magic: 123456789aaa") | ||
2601 | $2 = -3 | ||
2602 | list cpp-example-lib.hpp:13,13 | ||
2603 | 13 inline static const std::string test_string = "cpp-example-lib Magic: 123456789"; | ||
2604 | continue | ||
2588 | """ | 2605 | """ |
2589 | sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' | 2606 | sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' |
2590 | gdbserver_script = os.path.join(self._workspace_scripts_dir( | 2607 | gdbserver_script = os.path.join(self._workspace_scripts_dir( |
@@ -2609,10 +2626,21 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2609 | self.assertIn("gdbserver", r.output) | 2626 | self.assertIn("gdbserver", r.output) |
2610 | 2627 | ||
2611 | # Test remote debugging works | 2628 | # Test remote debugging works |
2612 | r = runCmd( | 2629 | gdb_batch_cmd = " --batch -ex 'break main' -ex 'run'" |
2613 | gdb_script + " --batch -ex 'break main' --ex 'run' -ex 'continue'") | 2630 | gdb_batch_cmd += " -ex 'break CppExample::print_json()' -ex 'continue'" |
2631 | gdb_batch_cmd += " -ex 'print CppExample::test_string.compare(\"cpp-example-lib %s\")'" % magic_string | ||
2632 | gdb_batch_cmd += " -ex 'print CppExample::test_string.compare(\"cpp-example-lib %saaa\")'" % magic_string | ||
2633 | gdb_batch_cmd += " -ex 'list cpp-example-lib.hpp:13,13'" | ||
2634 | gdb_batch_cmd += " -ex 'continue'" | ||
2635 | r = runCmd(gdb_script + gdb_batch_cmd) | ||
2636 | self.logger.debug("%s %s returned: %s", gdb_script, | ||
2637 | gdb_batch_cmd, r.output) | ||
2614 | self.assertEqual(r.status, 0) | 2638 | self.assertEqual(r.status, 0) |
2615 | self.assertIn("Breakpoint 1, main", r.output) | 2639 | self.assertIn("Breakpoint 1, main", r.output) |
2640 | self.assertIn("$1 = 0", r.output) # test.string.compare equal | ||
2641 | self.assertIn("$2 = -3", r.output) # test.string.compare longer | ||
2642 | self.assertIn( | ||
2643 | 'inline static const std::string test_string = "cpp-example-lib %s";' % magic_string, r.output) | ||
2616 | self.assertIn("exited normally", r.output) | 2644 | self.assertIn("exited normally", r.output) |
2617 | 2645 | ||
2618 | # Stop the gdbserver | 2646 | # Stop the gdbserver |
@@ -2689,14 +2717,12 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2689 | bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@%s -c --ide=none' % ( | 2717 | bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@%s -c --ide=none' % ( |
2690 | recipe_name, testimage, qemu.ip) | 2718 | recipe_name, testimage, qemu.ip) |
2691 | runCmd(bitbake_sdk_cmd) | 2719 | runCmd(bitbake_sdk_cmd) |
2720 | self._gdb_cross() | ||
2692 | self._verify_cmake_preset(tempdir) | 2721 | self._verify_cmake_preset(tempdir) |
2693 | self._devtool_ide_sdk_qemu(tempdir, qemu, recipe_name, example_exe) | 2722 | self._devtool_ide_sdk_qemu(tempdir, qemu, recipe_name, example_exe) |
2694 | # Verify the oe-scripts sym-link is valid | 2723 | # Verify the oe-scripts sym-link is valid |
2695 | self.assertEqual(self._workspace_scripts_dir( | 2724 | self.assertEqual(self._workspace_scripts_dir( |
2696 | recipe_name), self._sources_scripts_dir(tempdir)) | 2725 | recipe_name), self._sources_scripts_dir(tempdir)) |
2697 | # Verify GDB is working after devtool ide-sdk | ||
2698 | self._gdb_cross() | ||
2699 | self._gdb_cross_debugging(qemu, recipe_name, example_exe) | ||
2700 | 2726 | ||
2701 | # meson-example recipe | 2727 | # meson-example recipe |
2702 | recipe_name = "meson-example" | 2728 | recipe_name = "meson-example" |
@@ -2707,13 +2733,11 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2707 | bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@%s -c --ide=none' % ( | 2733 | bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@%s -c --ide=none' % ( |
2708 | recipe_name, testimage, qemu.ip) | 2734 | recipe_name, testimage, qemu.ip) |
2709 | runCmd(bitbake_sdk_cmd) | 2735 | runCmd(bitbake_sdk_cmd) |
2736 | self._gdb_cross() | ||
2710 | self._devtool_ide_sdk_qemu(tempdir, qemu, recipe_name, example_exe) | 2737 | self._devtool_ide_sdk_qemu(tempdir, qemu, recipe_name, example_exe) |
2711 | # Verify the oe-scripts sym-link is valid | 2738 | # Verify the oe-scripts sym-link is valid |
2712 | self.assertEqual(self._workspace_scripts_dir( | 2739 | self.assertEqual(self._workspace_scripts_dir( |
2713 | recipe_name), self._sources_scripts_dir(tempdir)) | 2740 | recipe_name), self._sources_scripts_dir(tempdir)) |
2714 | # Verify GDB is working after devtool ide-sdk | ||
2715 | self._gdb_cross() | ||
2716 | self._gdb_cross_debugging(qemu, recipe_name, example_exe) | ||
2717 | 2741 | ||
2718 | def test_devtool_ide_sdk_code_cmake(self): | 2742 | def test_devtool_ide_sdk_code_cmake(self): |
2719 | """Verify a cmake recipe works with ide=code mode""" | 2743 | """Verify a cmake recipe works with ide=code mode""" |