ó Â>Sc@sŽddlZddlZddlZddlZddlZddlZddlmZdej fd„ƒYZ e dkrŠej ƒndS(iÿÿÿÿN(t CrashDatabasetTcBsòeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsñtjƒ|_tjj|jdƒ|_tdidd6d|jd6ƒ|_ |j |j j |j j dƒdƒdƒ|j j dƒj ƒs td ƒ‚|j |j j dƒj ƒ|j j d ƒj ƒƒ|j |j jƒd ƒdS( Ntdupdbt1t dummy_datasfile://t dupdb_urlishttp://foo.bugs.example.com/0is2test-suite internal check: Python crash sigs existi(ttempfiletmkdtemptworkdirtostpathtjoint dupdb_dirRtNonetcrashest assertEqualtget_comment_urltdownloadtcrash_signaturetAssertionErrort latest_id(tself((s+/usr/share/apport/testsuite/test_crashdb.pytsetUp s$ cCstj|jƒdS(N(tshutiltrmtreeR(R((s+/usr/share/apport/testsuite/test_crashdb.pyttearDownscCsHtdiƒ|_|j|jjƒdƒ|jt|jjdƒdS(s!No dummy data is added by defaultiÿÿÿÿiN(RR RRRt assertRaisest IndexErrorR(R((s+/usr/share/apport/testsuite/test_crashdb.pyttest_no_dummy_datascCsQ|j|jjƒtdddgƒƒ|j|jjƒtddgƒƒdS(s+Bookkeeping in retraced and dupchecked bugsiiiiiN(RRtget_unretracedtsettget_dup_unchecked(R((s+/usr/share/apport/testsuite/test_crashdb.pyttest_retrace_markers&s(cCs¡tjƒ}|jdƒ|jƒtjjdd|jƒ}|j |j ddƒtjjdd|jƒ}|j d|j kƒ|j |j ddƒdS( sDynamic code in crashdb.confs&default = 'testsuite' def get_dyn(): return str(2 + 2) def get_dyn_name(): return 'on_the' + 'fly' databases = { 'testsuite': { 'impl': 'memory', 'dyn_option': get_dyn(), }, get_dyn_name(): { 'impl': 'memory', 'whoami': 'dynname', } } t dyn_optiont4t on_theflyt dyn_opiontwhoamitdynnameN( RtNamedTemporaryFiletwritetflushtapporttcrashdbt get_crashdbR tnameRtoptionst assertFalse(Rt crashdb_conftdb((s+/usr/share/apport/testsuite/test_crashdb.pyttest_dynamic_crashdb_conf,s  cCsj|j|jjtjdƒƒƒ|j|jjtjdƒƒƒ|j|jjtjdƒƒƒdS(s accepts(): default configurationtCrashtBugt weirdtypeN(t assertTrueRtacceptsR*tReport(R((s+/usr/share/apport/testsuite/test_crashdb.pyttest_accepts_defaultLs""cCsŸtjƒ}|jdƒ|jƒtjjdd|jƒ}|j |j tj dƒƒƒ|j |j tj dƒƒƒ|j |j tj dƒƒƒdS(s/accepts(): problem_types option in crashdb.confs‡default = 'testsuite' databases = { 'testsuite': { 'impl': 'memory', 'problem_types': ['Bug', 'Kernel'], }, } R4R3R5N( RR'R(R)R*R+R,R R-R6R7R8R/(RR0R1((s+/usr/share/apport/testsuite/test_crashdb.pyttest_accepts_problem_typesTs  cCsu|jjdƒ}|j|ddƒ|j|ddƒ|j|jjdddƒ|jt|jjdƒdS( sCrash uploading and downloadingit SourcePackagetfootPackages libfoo1 1.2-3tdup_ofiN(RRRtreportsR RR(Rtr((s+/usr/share/apport/testsuite/test_crashdb.pyt test_submitns cCs€|j|jjdƒdgƒ|j|jjdƒdgƒ|j|jjdƒdgƒ|j|jjdƒdgƒdS(NiR<iitbaritpygoo(RRtget_affected_packages(R((s+/usr/share/apport/testsuite/test_crashdb.pyttest_get_affected_packagesyscCsátjƒ}d|d¾scSsdS(Ns,/bin/bash:11:/lib/libc.so+123:/bin/bash+DEAD((((s+/usr/share/apport/testsuite/test_crashdb.pyRw¿sshttp://bash.bugs.example.com/5cSsdS(Ns/bin/bash:11:__getch:read:main((((s+/usr/share/apport/testsuite/test_crashdb.pyRwÆscSsdS(Ns>/bin/bash:11:/lib/libc.so+BEEF:/lib/libc.so+123:/bin/bash+DEAD((((s+/usr/share/apport/testsuite/test_crashdb.pyRwÇsshttp://bash.bugs.example.com/6cSsdS(Ns/bin/bash:11:__getch:read:main((((s+/usr/share/apport/testsuite/test_crashdb.pyRwÏscSsdS(Ns,/bin/bash:11:/lib/libc.so+123:/bin/bash+DEAD((((s+/usr/share/apport/testsuite/test_crashdb.pyRwÐsshttp://bash.bugs.example.com/7s:memory:iiis/bin/bash:11:read:mainN(iN(iN(R*R8Rtcrash_signature_addressesRRRRiR_R`R RXRat#_duplicate_search_address_signature(Rtatstb((s+/usr/share/apport/testsuite/test_crashdb.pyt%test_check_duplicate_multiple_masters±s>     $     $     $ "cCsc|jjdƒtjƒ}d|ds< ÿÿ¯