diff --git a/src/tests/integration/duplicate_attach_test.rb b/src/tests/integration/duplicate_attach_test.rb index daaff237..2996210a 100644 --- a/src/tests/integration/duplicate_attach_test.rb +++ b/src/tests/integration/duplicate_attach_test.rb @@ -1,228 +1,236 @@ # Copyright (C) 2017 Harald Sitter # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License or (at your option) version 3 or any later version # accepted by the membership of KDE e.V. (or its successor approved # by the membership of KDE e.V.), which shall act as a proxy # defined in Section 14 of version 3 of the license. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . require_relative 'test_helper' +require 'json' require 'xmlrpc/client' require 'xmlrpc/server' # Monkey patch the xmlrpc server to let us handle regular GET requests. # Drkonqi partially goes through regular bugzilla cgi's simply requesting xml # output. module XMLServerInterceptor # raw xml data is here # def process(*args) # warn "+++ #{__method__} +++" # p args # warn "--- #{__method__} ---" # super # end def service(req, resp) # Where webrick comes in with request, server rejects non-xmlrpc requests # so we'll manually handle GET requests as necessary and forward to an # actual bugzilla so we don't have to reimplement everything. warn "+++ #{__method__} +++" if req.request_method == 'GET' if req.request_uri.path.include?('buglist.cgi') # Returns CSV. resp.body = <<-EOF bug_id,"bug_severity","priority","bug_status","product","short_desc","resolution" 375161,"crash","NOR","NEEDSINFO","dolphin","Dolphin crash, copy from Samba share","BACKTRACE" EOF return end if req.request_uri.path.include?('show_bug.cgi') + if req.request_uri.query.include?('id=375161') + resp.body = File.read("#{__dir__}/xml-data/show_bug.cgi?id=375161&ctype=xml") + return + end + uri = req.request_uri.dup uri.host = 'bugstest.kde.org' uri.scheme = 'https' uri.port = nil resp.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, uri.to_s) return end end warn "--- #{__method__} ---" super end end class XMLRPC::Server prepend XMLServerInterceptor # Expose webrick server so we can get our port :| # https://github.com/ruby/xmlrpc/issues/17 attr_accessor :server end class TestDuplicateAttach < ATSPITest def setup server = XMLRPC::Server.new(0) port = server.server.config.fetch(:Port) ENV['DRKONQI_KDE_BUGZILLA_URL'] = "http://localhost:#{port}/" @got_comment = false server.set_default_handler do |name, args| puts '+++ handler +++' p name, args - if name == 'User.login' + case name + when 'User.login' next {"id"=>12345, "token"=>"12345-cJ5o717AbC"} - end - if name == 'Bug.update' + when 'Bug.update' id = args.fetch('ids').fetch(0) cc_to_add = args.fetch('cc').fetch('add') next {"bugs"=>[{"last_change_time"=>DateTime.now, "id"=>id, "changes"=>{"cc"=>{"removed"=>"", "added"=>cc_to_add}}, "alias"=>[]}]} - end - if name == 'Bug.add_attachment' + when 'Bug.add_attachment' # Check for garbage string from test @got_comment = args.fetch('comment').include?('yyyyyyyyyyyyyyyy') next { "ids" => [1234] } + when 'Bugzilla.version' + next JSON.parse(File.read("#{__dir__}/rpc-data/Bugzilla.version")) end puts '~~~ bugzilla ~~~' # Pipe request through bugstest. # The arguments are killing me. client = XMLRPC::Client.new('bugstest.kde.org', '/xmlrpc.cgi', 443, nil, nil, nil, nil, true) bugzilla = client.call(name, *args) p bugzilla next bugzilla end @xml_server_thread = Thread.start { server.serve } @tracee = fork { loop { sleep(999_999_999) } } assert File.exist?(DRKONQI_PATH), "drkonqi not at #{DRKONQI_PATH}" @drkonqi_pid = spawn(DRKONQI_PATH, '--signal', '11', '--pid', @tracee.to_s, '--bugaddress', 'submit@bugs.kde.org', '--dialog') puts "pid: #{@drkonqi_pid}" end def teardown Process.kill('KILL', @tracee) Process.waitpid2(@tracee) @xml_server_thread.kill @xml_server_thread.join end def drkonqi_running? Process.waitpid(@drkonqi_pid, Process::WNOHANG).nil? end # When evaluating duplicates def test_duplicate_attach drkonqi = nil 8.times do # be gracious for drkonqi to come up an atspi drkonqi = ATSPI.applications.find { |x| x.name == 'drkonqi' } break if drkonqi sleep 2 end refute_nil drkonqi, 'Could not find drkonqi on atspi api.' \ " It is running: #{drkonqi_running?}" accessible = find_in(drkonqi.windows[-1], name: 'Report Bug') press(accessible) find_in(drkonqi, name: 'Crash Reporting Assistant') do |window| accessible = find_in(window, name: 'Next') press(accessible) accessible = find_in(window, name: 'Yes') toggle_on(accessible) accessible = find_in(window, name: /^What I was doing when the application.+/) toggle_on(accessible) accessible = find_in(window, name: 'Next') press(accessible) loop do # Drkonqi is now doing the trace, wait until it is done. accessible = find_in(window, name: 'Next') refute_nil accessible if accessible.states.include?(:sensitive) press(accessible) break end warn accessible.states sleep 2 end # Set pseudo login data if there are none. accessible = find_in(window, name: 'Username input') accessible.text.set_to 'xxx' if accessible.text.length <= 0 - accessible = find_in(window, name: 'Password input') + # the lineedit is in fact an element on the input. why wouldn't it be... + accessible = find_in(window, name: 'Password input').children[0] accessible.text.set_to 'yyy' if accessible.text.length <= 0 accessible = find_in(window, name: 'Login') press(accessible) sleep 2 # Wait for login and bug listing accessible = find_in(window, name: '375161') toggle_on(accessible) accessible = find_in(window, name: 'Open selected report') press(accessible) end find_in(drkonqi, name: 'Bug Description') do |window| accessible = find_in(window, name: 'Suggest this crash is related') press(accessible) end find_in(drkonqi, name: 'Related Bug Report') do |window| accessible = find_in(window, name: /^Completely sure: attach my information.+/) toggle_on(accessible) accessible = find_in(window, name: 'Continue') press(accessible) end find_in(drkonqi, name: 'Crash Reporting Assistant') do |window| accessible = find_in(window, name: /^The report is going to be attached.+/) refute_nil accessible accessible = find_in(window, name: 'Next') press(accessible) accessible = find_in(window, name: 'Information about the crash text') accessible.text.set_to(accessible.text.to_s + Array.new(128).collect { 'y' }.join) accessible = find_in(window, name: 'Next') press(accessible) accessible = find_in(window, name: 'Next') press(accessible) accessible = find_in(window, name: /.*Crash report sent.*/) refute_nil accessible accessible = find_in(window, name: 'Finish') press(accessible) end assert @got_comment # only true iff the server go tour yyyyyy garbage string end end diff --git a/src/tests/integration/rpc-data/Bugzilla.version b/src/tests/integration/rpc-data/Bugzilla.version new file mode 100644 index 00000000..3008cf4d --- /dev/null +++ b/src/tests/integration/rpc-data/Bugzilla.version @@ -0,0 +1 @@ +{"version":"5.0.6"} diff --git a/src/tests/integration/xml-data/show_bug.cgi?id=375161&ctype=xml b/src/tests/integration/xml-data/show_bug.cgi?id=375161&ctype=xml new file mode 100644 index 00000000..740f698e --- /dev/null +++ b/src/tests/integration/xml-data/show_bug.cgi?id=375161&ctype=xml @@ -0,0 +1,165 @@ + + + + + + + 375161 + + 2017-01-16 21:57:27 +0000 + Dolphin crash, copy from Samba share + 2017-10-28 09:58:26 +0000 + 1 + 1 + 1 + Unclassified + dolphin + general + 16.08.2 + openSUSE RPMs + Linux + UNCONFIRMED + + + + + + drkonqi + NOR + crash + --- + + + 0 + j.peter0123@gmail.com + dolphin-bugs-null@kde.org + elvis.angelaccio@kde.org + + + + 0 + + + 1562664405-KDZ4-KXnqyziC6h0NfV7uxL4Or5VvoTZNZvYgV4bJpE + + + + + + oldest_to_newest + + 1654770 + 0 + j.peter0123@gmail.com + 2017-01-16 21:57:27 +0000 + Application: dolphin (16.08.2) + +Qt Version: 5.6.1 +Frameworks Version: 5.26.0 +Operating System: Linux 4.4.36-8-default x86_64 +Distribution: "openSUSE Leap 42.2" + +-- Information about the crash: +- What I was doing when the application crashed: +I had copyed files from Samba share (with drag and drop methode). + +-- Backtrace: +Application: Dolphin (dolphin), signal: Segmentation fault +Using host libthread_db library "/lib64/libthread_db.so.1". +[Current thread is 1 (Thread 0x7f03846b5900 (LWP 4820))] + +Thread 4 (Thread 0x7f035bfff700 (LWP 4823)): +#0 0x00007f0383f8951d in read () at /lib64/libc.so.6 +#1 0x00007f037430b073 in () at /usr/lib64/tls/libnvidia-tls.so.375.26 +#2 0x00007f0378dbb670 in () at /usr/lib64/libglib-2.0.so.0 +#3 0x00007f0378d7ae49 in g_main_context_check () at /usr/lib64/libglib-2.0.so.0 +#4 0x00007f0378d7b2a8 in () at /usr/lib64/libglib-2.0.so.0 +#5 0x00007f0378d7b42c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 +#6 0x00007f037e26932b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5 +#7 0x00007f037e216fdb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5 +#8 0x00007f037e051f1a in QThread::exec() () at /usr/lib64/libQt5Core.so.5 +#9 0x00007f037e0569e9 in () at /usr/lib64/libQt5Core.so.5 +#10 0x00007f0379902734 in start_thread () at /lib64/libpthread.so.0 +#11 0x00007f0383f95d3d in clone () at /lib64/libc.so.6 + +Thread 3 (Thread 0x7f036a0f2700 (LWP 4822)): +#0 0x00007f0383f8951d in read () at /lib64/libc.so.6 +#1 0x00007f037430b073 in () at /usr/lib64/tls/libnvidia-tls.so.375.26 +#2 0x00007f0378dbb670 in () at /usr/lib64/libglib-2.0.so.0 +#3 0x00007f0378d7ae49 in g_main_context_check () at /usr/lib64/libglib-2.0.so.0 +#4 0x00007f0378d7b2a8 in () at /usr/lib64/libglib-2.0.so.0 +#5 0x00007f0378d7b42c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 +#6 0x00007f037e26932b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5 +#7 0x00007f037e216fdb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5 +#8 0x00007f037e051f1a in QThread::exec() () at /usr/lib64/libQt5Core.so.5 +#9 0x00007f037e67d1d5 in () at /usr/lib64/libQt5DBus.so.5 +#10 0x00007f037e0569e9 in () at /usr/lib64/libQt5Core.so.5 +#11 0x00007f0379902734 in start_thread () at /lib64/libpthread.so.0 +#12 0x00007f0383f95d3d in clone () at /lib64/libc.so.6 + +Thread 2 (Thread 0x7f036c09b700 (LWP 4821)): +#0 0x00007f0383f8d49d in poll () at /lib64/libc.so.6 +#1 0x00007f0376c703e2 in () at /usr/lib64/libxcb.so.1 +#2 0x00007f0376c71fcf in xcb_wait_for_event () at /usr/lib64/libxcb.so.1 +#3 0x00007f036ec27839 in () at /usr/lib64/libQt5XcbQpa.so.5 +#4 0x00007f037e0569e9 in () at /usr/lib64/libQt5Core.so.5 +#5 0x00007f0379902734 in start_thread () at /lib64/libpthread.so.0 +#6 0x00007f0383f95d3d in clone () at /lib64/libc.so.6 + +Thread 1 (Thread 0x7f03846b5900 (LWP 4820)): +[KCrash Handler] +#6 0x00007f0383f28296 in malloc_usable_size () at /lib64/libc.so.6 +#7 0x00007f03783d5139 in () at /usr/X11R6/lib64/libGL.so.1 +#8 0x00007f037430b1fc in () at /usr/lib64/tls/libnvidia-tls.so.375.26 +#9 0x00007f037e2414a4 in QObjectPrivate::Connection::~Connection() () at /usr/lib64/libQt5Core.so.5 +#10 0x00007f037e246dcc in QObjectPrivate::cleanConnectionLists() () at /usr/lib64/libQt5Core.so.5 +#11 0x00007f037e246eab in QObjectPrivate::addConnection(int, QObjectPrivate::Connection*) () at /usr/lib64/libQt5Core.so.5 +#12 0x00007f037e2475c6 in () at /usr/lib64/libQt5Core.so.5 +#13 0x00007f037e247d57 in QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType) () at /usr/lib64/libQt5Core.so.5 +#14 0x00007f038207b54d in () at /usr/lib64/libKF5KIOCore.so.5 +#15 0x00007f038208c686 in () at /usr/lib64/libKF5KIOCore.so.5 +#16 0x00007f037e242bb1 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib64/libQt5Core.so.5 +#17 0x00007f037e250112 in QTimer::timerEvent(QTimerEvent*) () at /usr/lib64/libQt5Core.so.5 +#18 0x00007f037e243f34 in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5 +#19 0x00007f037f1a0e3c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5 +#20 0x00007f037f1a549a in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5 +#21 0x00007f037e218fc5 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5 +#22 0x00007f037e268c7e in QTimerInfoList::activateTimers() () at /usr/lib64/libQt5Core.so.5 +#23 0x00007f037e269079 in () at /usr/lib64/libQt5Core.so.5 +#24 0x00007f0378d7b134 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0 +#25 0x00007f0378d7b388 in () at /usr/lib64/libglib-2.0.so.0 +#26 0x00007f0378d7b42c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0 +#27 0x00007f037e26930c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5 +#28 0x00007f037e216fdb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5 +#29 0x00007f037e21eec6 in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5 +#30 0x00007f03842b196a in kdemain () at /usr/lib64/libkdeinit5_dolphin.so +#31 0x00007f0383ecc6e5 in __libc_start_main () at /lib64/libc.so.6 +#32 0x0000000000400789 in _start () + +Reported using DrKonqi + + 1654785 + 1 + elvis.angelaccio@kde.org + 2017-01-16 22:45:08 +0000 + Thanks for the report. Unfortunately the backtracke is not very useful. If you can reproduce the crash, please install debug symbols and attach a new backtrace here. See also https://community.kde.org/Dolphin/FAQ/Crashes + + 1708610 + 2 + elvis.angelaccio@kde.org + 2017-10-28 09:58:26 +0000 + + +*** This bug has been marked as a duplicate of bug 386277 *** + + + + + + +