From d97bdcbd393f4a815fba4ab5fb148545d1be51f5 Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Sun, 16 Oct 2016 07:34:15 -0400 Subject: [PATCH] lttng.ui.test: Enable SymbolMap test Change-Id: I869219981337d6a2d7daf0ac4f79763803585f11 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/83320 Reviewed-by: Genevieve Bastien Tested-by: Genevieve Bastien Reviewed-by: Hudson CI --- .../core/tests/shared/cyg-profile-mapping.txt | 138 ++++++++++++++++++ .../ui/swtbot/tests/CallStackViewTest.java | 63 +++++--- 2 files changed, 182 insertions(+), 19 deletions(-) create mode 100644 ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/cyg-profile-mapping.txt diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/cyg-profile-mapping.txt b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/cyg-profile-mapping.txt new file mode 100644 index 0000000000..7960d50655 --- /dev/null +++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/cyg-profile-mapping.txt @@ -0,0 +1,138 @@ +00000000006062cc b angle +0000000000606248 d animate +00000000006062e0 b asp +0000000000606290 d blue.19445 +00000000006062b0 B __bss_start +00000000006062b8 b completed.6718 + U cos@@GLIBC_2.2.5 +0000000000401aac t current_time + U __cyg_profile_func_enter@@GLIBC_2.2.5 + U __cyg_profile_func_exit@@GLIBC_2.2.5 +0000000000606230 D __data_start +0000000000606230 W data_start +00000000004019f0 t deregister_tm_clones +0000000000401a60 t __do_global_dtors_aux +0000000000605de8 t __do_global_dtors_aux_fini_array_entry +00000000004033a7 t draw +0000000000403760 t draw_frame +000000000040357a t draw_gears +0000000000606238 D __dso_handle +0000000000605df8 d _DYNAMIC +00000000006062b0 D _edata +00000000006062e8 B _end +00000000004045c8 t event_loop + U exit@@GLIBC_2.2.5 +000000000060624c d eyesep + U fflush@@GLIBC_2.2.5 +0000000000404c54 T _fini +0000000000606250 d fix_point +0000000000401a80 t frame_dummy +0000000000605de0 t __frame_dummy_init_array_entry +0000000000405470 r __FRAME_END__ +00000000006062e4 b frames.19426 +00000000006062d0 b fullscreen +0000000000401b23 t gear +00000000006062c0 b gear1 +00000000006062c4 b gear2 +00000000006062c8 b gear3 + U getenv@@GLIBC_2.2.5 + U gettimeofday@@GLIBC_2.2.5 + U glBegin + U glCallList + U glClear + U glDeleteLists + U glDrawBuffer + U glEnable + U glEnd + U glEndList + U glFrustum + U glGenLists + U glGetString + U glLightfv + U glLoadIdentity + U glMaterialfv + U glMatrixMode + U glNewList + U glNormal3f +0000000000606000 d _GLOBAL_OFFSET_TABLE_ + U glPopMatrix + U glPushMatrix + U glRotatef + U glShadeModel + U glTranslated + U glTranslatef + U glVertex3f + U glViewport + U glXChooseVisual + U glXCreateContext + U glXDestroyContext + U glXGetProcAddressARB + U glXMakeCurrent + U glXQueryDrawable + U glXQueryExtensionsString + U glXSwapBuffers + w __gmon_start__ +0000000000606280 d green.19444 +0000000000404412 t handle_event +0000000000403b14 t init +0000000000401560 T _init +0000000000605de8 t __init_array_end +0000000000605de0 t __init_array_start +0000000000404c60 R _IO_stdin_used +0000000000404244 t is_glx_extension_supported + w _ITM_deregisterTMCloneTable + w _ITM_registerTMCloneTable +0000000000605df0 d __JCR_END__ +0000000000605df0 d __JCR_LIST__ + w _Jv_RegisterClasses +00000000006062d8 b left +0000000000404c50 T __libc_csu_fini +0000000000404bc0 T __libc_csu_init + U __libc_start_main@@GLIBC_2.2.5 +000000000040472b T main +0000000000403d60 t make_window +0000000000405034 r MWM_HINTS_DECORATIONS.19450 +0000000000403cb1 t no_border +0000000000606260 d pos.19442 + U printf@@GLIBC_2.2.5 +0000000000405038 r PROP_MOTIF_WM_HINTS_ELEMENTS.19451 + U puts@@GLIBC_2.2.5 +0000000000404311 t query_vsync +0000000000606270 d red.19443 +0000000000401a20 t register_tm_clones +000000000040392b t reshape +00000000006062dc b right +00000000006062d4 b samples + U sin@@GLIBC_2.2.5 + U sqrt@@GLIBC_2.2.5 + U __stack_chk_fail@@GLIBC_2.4 +00000000004019c0 T _start +00000000006062b0 B stdout@@GLIBC_2.2.5 +00000000006062d1 b stereo + U strcmp@@GLIBC_2.2.5 + U strlen@@GLIBC_2.2.5 + U strstr@@GLIBC_2.2.5 + U strtod@@GLIBC_2.2.5 +00000000006062b0 D __TMC_END__ +00000000006062a8 d tRate0.19428 +00000000006062a0 d tRot0.19427 +00000000004046bd t usage +0000000000606240 d view_rotx +0000000000606244 d view_roty +00000000006062bc b view_rotz + U XChangeProperty + U XCloseDisplay + U XCreateColormap + U XCreateWindow + U XDestroyWindow + U XFree + U XInternAtom + U XLookupKeysym + U XLookupString + U XMapWindow + U XNextEvent + U XOpenDisplay + U XParseGeometry + U XPending + U XSetNormalHints + U XSetStandardProperties diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java b/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java index 25f7d5f00f..e79c0cedde 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java @@ -12,11 +12,12 @@ package org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -25,11 +26,15 @@ import java.util.stream.Collectors; import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; +import org.eclipse.core.runtime.FileLocator; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.SWTBot; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; +import org.eclipse.swtbot.swt.finder.waits.Conditions; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; @@ -39,6 +44,7 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal; import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp; import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils; +import org.eclipse.tracecompass.tmf.ui.dialog.TmfFileDialogFactory; import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils; import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils; @@ -46,7 +52,6 @@ import org.eclipse.tracecompass.tmf.ui.views.callstack.CallStackView; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -69,7 +74,7 @@ public class CallStackViewTest { /** * Timestamps of consecutive events in the trace */ - private static final long TIMESTAMPS[] = new long[] { + private static final long TIMESTAMPS[] = new long[] { 1378850463804898643l, 1378850463804899057l, 1378850463804900219l, @@ -87,17 +92,17 @@ public class CallStackViewTest { * Stack frames of consecutive events in the trace */ private static final String[] STACK_FRAMES[] = new String[][] { - {"0x40472b", "0x4045c8", "0x404412", "", ""}, - {"0x40472b", "0x4045c8", "0x404412", "0x40392b", ""}, - {"0x40472b", "0x4045c8", "0x404412", "", ""}, - {"0x40472b", "0x4045c8", "", "", ""}, - {"0x40472b", "0x4045c8", "0x404412", "", ""}, - {"0x40472b", "0x4045c8", "0x404412", "0x40392b", ""}, - {"0x40472b", "0x4045c8", "0x404412", "", ""}, - {"0x40472b", "0x4045c8", "", "", ""}, - {"0x40472b", "0x4045c8", "0x404412", "", ""}, - {"0x40472b", "0x4045c8", "0x404412", "0x40392b", ""}, - {"0x40472b", "0x4045c8", "0x404412", "", ""}, + { "0x40472b", "0x4045c8", "0x404412", "", "" }, + { "0x40472b", "0x4045c8", "0x404412", "0x40392b", "" }, + { "0x40472b", "0x4045c8", "0x404412", "", "" }, + { "0x40472b", "0x4045c8", "", "", "" }, + { "0x40472b", "0x4045c8", "0x404412", "", "" }, + { "0x40472b", "0x4045c8", "0x404412", "0x40392b", "" }, + { "0x40472b", "0x4045c8", "0x404412", "", "" }, + { "0x40472b", "0x4045c8", "", "", "" }, + { "0x40472b", "0x4045c8", "0x404412", "", "" }, + { "0x40472b", "0x4045c8", "0x404412", "0x40392b", "" }, + { "0x40472b", "0x4045c8", "0x404412", "", "" }, }; /** Tooltips of the toolbar buttons */ @@ -297,14 +302,33 @@ public class CallStackViewTest { /** * Test check callstack at a time with function map + * + * @throws URISyntaxException + * Malformed url + * @throws IOException + * Missing file */ - @Ignore @Test - public void testGoToTimeAndCheckStackWithNames() { + public void testGoToTimeAndCheckStackWithNames() throws URISyntaxException, IOException { goToTime(TIMESTAMPS[0]); final SWTBotView viewBot = fBot.viewById(CallStackView.ID); viewBot.setFocus(); - // no way to load mappings yet! :( + Object mapObj = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt"); + assertTrue(mapObj instanceof URL); + URL mapUrl = (URL) mapObj; + + String absoluteFile = FileLocator.toFileURL(mapUrl).getFile(); + TmfFileDialogFactory.setOverrideFiles(absoluteFile); + viewBot.toolbarButton("Configure how the addresses are mapped to function names").click(); + String shellTitle = "Symbol mapping"; + fBot.waitUntil(Conditions.shellIsActive(shellTitle)); + SWTBot shellBot = fBot.shell(shellTitle).bot(); + SWTBotShell activeShell = shellBot.activeShell(); + shellBot.radio(1).click(); + shellBot.button("Browse...", 1).click(); + shellBot.button("OK").click(); + shellBot.waitUntil(Conditions.shellCloses(activeShell)); + SWTBotTree tree = viewBot.bot().tree(); WaitUtils.waitForJobs(); List names = new ArrayList<>(); @@ -315,6 +339,7 @@ public class CallStackViewTest { } } } + assertEquals(names, ImmutableList.of("glxgears-16073")); } /** -- 2.34.1