tests.sh 236 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733
  1. #!/bin/sh
  2. # $Id: tests.sh,v 1.374 2022/09/15 08:43:20 gilles Exp gilles $
  3. # To run these tests, you need a running imap server somewhere
  4. # with several accounts. And be on Linux or Unix.
  5. #
  6. # Tests will break as they are home specific, they depend on the content
  7. # of the mailboxes, which are not given here.
  8. #
  9. # Anyway, those tests are good as imapsync examples.
  10. #
  11. # All mandatory tests are run with:
  12. #
  13. # sh tests.sh
  14. #
  15. # Specific tests can be run by using them as arguments to tests.sh:
  16. #
  17. # sh tests.sh ll_ssl_justconnect ll_bad_host ...
  18. HOST1=${HOST1:-'localhost'}
  19. echo HOST1=$HOST1
  20. HOST2=${HOST2:-'localhost'}
  21. echo HOST2=$HOST2
  22. # most tests use:
  23. CMD_PERL='perl -I./W/Mail-IMAPClient-3.43/lib'
  24. #### Shell pragmas
  25. #### functions definitions
  26. # File handle 3 is redirected to STDERR so that echo3 prints
  27. # on the terminal even with "sh test.sh > /dev/null"
  28. # I want to see the names of the tests and their count while
  29. # they're running but I don't want to see their output, it's too noisy.
  30. exec 3>&2
  31. echo3() {
  32. #echo '#####################################################' >&3
  33. echo "$@" >&3
  34. }
  35. #
  36. echolog() {
  37. echo "`date_ymdhms` : $@" >> W/.tests.errors.txt
  38. echo3 Last errors listed in W/.tests.errors.txt
  39. }
  40. run_test() {
  41. echo3 "#### $tests_count $1"
  42. setxon
  43. # do not run anything between the two following instructions
  44. $1; run_test_status=$?
  45. # now you can run
  46. setxback 2> /dev/null
  47. if test x"$run_test_status" = x"0"; then
  48. echo "$1 passed"
  49. else
  50. echo3 "$1 failed"
  51. fi
  52. return $run_test_status
  53. }
  54. setxon() {
  55. if ! { echo $-|grep x ; } ; then
  56. #echo 'set -x was off'
  57. setx_restore_cmd='set +x'
  58. set -x
  59. else
  60. echo 'set -x already on'
  61. setx_restore_cmd=""
  62. fi
  63. }
  64. setxback() {
  65. $setx_restore_cmd
  66. }
  67. run_tests() {
  68. for t in "$@"; do
  69. tests_count=`expr 1 + $tests_count`
  70. #
  71. if ! run_test "$t"; then
  72. tests_failed_count=`expr 1 + $tests_failed_count`
  73. tests_failed_list="$tests_failed_list $t"
  74. fi
  75. sleep 0
  76. done
  77. if test 0 -eq $tests_failed_count; then
  78. echo3 "ALL $tests_count TESTS SUCCESSFUL"
  79. echolog "ALL $tests_count TESTS SUCCESSFUL"
  80. return 0
  81. else
  82. # At least one failed
  83. echo3 "FAILED $tests_failed_count/$tests_count TESTS: $tests_failed_list"
  84. echolog "FAILED $tests_failed_count/$tests_count TESTS: $tests_failed_list"
  85. return 1
  86. fi
  87. }
  88. #### Variable definitions
  89. tests_count=0
  90. tests_failed_count=0
  91. ##### The tests functions
  92. perl_syntax() {
  93. $CMD_PERL -c ./imapsync
  94. }
  95. no_args() {
  96. $CMD_PERL ./imapsync
  97. }
  98. # list of accounts on petite :
  99. # mailboxes toto -> titi used on first_sync()
  100. # mailboxes tata -> titi used on ll()
  101. # mailboxes tata -> titi on most ll_*() tests
  102. # mailbox tete@est.belle used on big folder size tests:
  103. # huge_folder()
  104. # huge_folder_sizes_only()
  105. # dprof()
  106. # mailbox big1 big2 used on bigmail message tests
  107. # ll_bigmail()
  108. # ll_memory_consumption
  109. # mailboxes toto -> delme -> delme used on ll_delself
  110. sendtestmessage() {
  111. email=${1:-"tata"}
  112. rand=${2:-"`pwgen 16 1`"}
  113. mess='test: '"$rand"
  114. cmd="echo $mess""| mail -s '""$mess""' $email"
  115. echo $cmd
  116. eval "$cmd"
  117. }
  118. sendtestmessage_titi() {
  119. email=${1:-"titi"}
  120. rand=${2:-"`pwgen 16 1`"}
  121. mess='test: '"$rand"
  122. cmd="echo $mess""| mail -s '""$mess""' $email"
  123. echo $cmd
  124. eval "$cmd"
  125. }
  126. can_send() {
  127. # no send at all
  128. #return 1
  129. test X`hostname` = X"petite" && return 0;
  130. test X`hostname` = X"plume" && return 0;
  131. test X`hostname` = X"vadrouille" && return 0;
  132. return 1
  133. }
  134. at_home() {
  135. test X`hostname` = X"petite" && return 0;
  136. return 1
  137. }
  138. zzzz() {
  139. $CMD_PERL -V
  140. }
  141. set_return_code_variables()
  142. {
  143. # Copy from imapsync
  144. EX_OK=0 #/* successful termination */
  145. EX_USAGE=64 #/* command line usage error */
  146. EX_NOINPUT=66 #/* cannot open input */
  147. EX_UNAVAILABLE=69 #/* service unavailable */
  148. EX_SOFTWARE=70 #/* internal software error */
  149. EXIT_CATCH_ALL=1 # Any other error
  150. EXIT_BY_SIGNAL=6
  151. EXIT_BY_SIGQUIT=131 # 128+3
  152. EXIT_BY_SIGKILL=137 # 128+9
  153. EXIT_BY_SIGTERM=143 # 128+15
  154. EXIT_BY_FILE=7
  155. EXIT_PID_FILE_ERROR=8
  156. EXIT_CONNECTION_FAILURE=10
  157. EXIT_CONNECTION_FAILURE_HOST1=101
  158. EXIT_CONNECTION_FAILURE_HOST2=102
  159. EXIT_TLS_FAILURE=12
  160. EXIT_AUTHENTICATION_FAILURE=16
  161. EXIT_AUTHENTICATION_FAILURE_USER1=161
  162. EXIT_AUTHENTICATION_FAILURE_USER2=162
  163. EXIT_SUBFOLDER1_NO_EXISTS=21
  164. EXIT_WITH_ERRORS=111
  165. EXIT_WITH_ERRORS_MAX=112
  166. EXIT_OVERQUOTA=113
  167. EXIT_ERR_APPEND=114
  168. EXIT_ERR_FETCH=115
  169. EXIT_ERR_CREATE=116
  170. EXIT_ERR_SELECT=117
  171. EXIT_TRANSFER_EXCEEDED=118
  172. EXIT_ERR_APPEND_VIRUS=119
  173. EXIT_ERR_FLAGS=120
  174. EXIT_TESTS_FAILED=254 # Like Test::More API
  175. }
  176. # general tests start
  177. option_version() {
  178. $CMD_PERL ./imapsync --version
  179. }
  180. option_tests() {
  181. $CMD_PERL ./imapsync --tests
  182. }
  183. option_tests_in_var_tmp_sub() {
  184. (
  185. mkdir -p /var/tmp/imapsync_tests
  186. cd /var/tmp/imapsync_tests
  187. /g/public_html/imapsync/imapsync --tests
  188. )
  189. }
  190. option_tests_in_var_tmp() {
  191. (
  192. cd /var/tmp/
  193. /g/public_html/imapsync/imapsync --tests
  194. )
  195. }
  196. option_testsdebug() {
  197. $CMD_PERL ./imapsync --testsdebug
  198. }
  199. option_releasecheck() {
  200. $CMD_PERL ./imapsync --help --releasecheck | egrep 'This imapsync.*local.*official'
  201. }
  202. option_noreleasecheck() {
  203. ! { $CMD_PERL ./imapsync --help --noreleasecheck | egrep 'This imapsync.*local.*official' ; }
  204. }
  205. option_bad_delete2() {
  206. $CMD_PERL ./imapsync --delete 2 --blabla
  207. test "$?" = "$EX_USAGE"
  208. }
  209. option_extra_arguments() {
  210. $CMD_PERL ./imapsync --testslive blabla
  211. test "$?" = "$EX_USAGE"
  212. }
  213. option_extra() {
  214. (
  215. mkdir -p W/tmp/tests/options_extra/ || return 1
  216. cd W/tmp/tests/options_extra/ || return 1
  217. echo '--debugimap' > options_extra.txt
  218. test -f ../../../../imapsync
  219. ../../../../imapsync --testslive
  220. test "$?" = "$EX_OK"
  221. )
  222. pwd
  223. }
  224. passwords_masked() {
  225. $CMD_PERL ./imapsync --host1 boumboum --password1 secret --justbanner | grep MASKED
  226. }
  227. passwords_not_masked() {
  228. $CMD_PERL ./imapsync --host1 boumboum --password1 secret --justbanner --showpasswords| grep secret
  229. }
  230. passwords_dollar() {
  231. $CMD_PERL ./imapsync --host1 boumboum --user1 ee --password1 '$secret' --host2 boumboum --user2 ee --password2 '$secret' --showpasswords
  232. }
  233. passwords_parenthese() {
  234. #$CMD_PERL ./imapsync --host1 $HOST1 --user1 ee --password1 '( secret' --host2 $HOST2 --user2 ee --password2 '(secret' --showpasswords --debugimap1
  235. $CMD_PERL ./imapsync --host1 $HOST1 --user1 ee --password1 'secret )' --host2 $HOST2 --user2 ee --password2 '(secret' --showpasswords --debugimap1
  236. }
  237. passfile1_noexist() {
  238. $CMD_PERL ./imapsync \
  239. --host1 $HOST1 --user1 tata \
  240. --passfile1 /noexists \
  241. --host2 $HOST2 --user2 titi \
  242. --passfile2 ../../var/pass/secret.titi
  243. test "$?" = "$EX_NOINPUT"
  244. }
  245. passfile2_noexist() {
  246. $CMD_PERL ./imapsync \
  247. --host1 $HOST1 --user1 tata \
  248. --passfile1 ../../var/pass/secret.tata \
  249. --host2 $HOST2 --user2 titi \
  250. --passfile2 /noexists
  251. test "$?" = "$EX_NOINPUT"
  252. }
  253. ll_showpasswords() {
  254. $CMD_PERL ./imapsync \
  255. --host1 $HOST1 --user1 tata \
  256. --password1 'ami\"seen' \
  257. --host2 $HOST2 --user2 titi \
  258. --passfile2 ../../var/pass/secret.titi \
  259. --justlogin --showpasswords --debugimap1
  260. }
  261. ll_dry()
  262. {
  263. # The first is to create INBOX.dry on host2
  264. $CMD_PERL ./imapsync \
  265. --host1 $HOST1 --user1 tata \
  266. --passfile1 ../../var/pass/secret.tata \
  267. --host2 $HOST2 --user2 titi \
  268. --passfile2 ../../var/pass/secret.titi \
  269. --folder INBOX --f1f2 INBOX=INBOX.dry --justfolders
  270. time $CMD_PERL ./imapsync \
  271. --host1 $HOST1 --user1 tata \
  272. --passfile1 ../../var/pass/secret.tata \
  273. --host2 $HOST2 --user2 titi \
  274. --passfile2 ../../var/pass/secret.titi \
  275. --folder INBOX --f1f2 INBOX=INBOX.dry --dry
  276. }
  277. ll_dry_nodry1()
  278. {
  279. time $CMD_PERL ./imapsync \
  280. --host1 $HOST1 --user1 tata \
  281. --passfile1 ../../var/pass/secret.tata \
  282. --host2 $HOST2 --user2 titi \
  283. --passfile2 ../../var/pass/secret.titi \
  284. --folder INBOX --f1f2 INBOX=INBOX.dry --dry --nodry1
  285. }
  286. ll_dry_maxage()
  287. {
  288. time $CMD_PERL ./imapsync \
  289. --host1 $HOST1 --user1 tata \
  290. --passfile1 ../../var/pass/secret.tata \
  291. --host2 $HOST2 --user2 titi \
  292. --passfile2 ../../var/pass/secret.titi \
  293. --folder INBOX --f1f2 INBOX=INBOX.dry --dry --maxage 7
  294. }
  295. # In mandatory_tests
  296. ll_justhost1()
  297. {
  298. $CMD_PERL ./imapsync --host1 $HOST2
  299. }
  300. # In mandatory_tests
  301. ll_justhost2()
  302. {
  303. $CMD_PERL ./imapsync --host2 $HOST2
  304. }
  305. # In mandatory_tests
  306. testslive() {
  307. $CMD_PERL ./imapsync --testslive
  308. }
  309. # In mandatory_tests
  310. testslive6() {
  311. $CMD_PERL ./imapsync --testslive6
  312. }
  313. first_sync_dry() {
  314. $CMD_PERL ./imapsync \
  315. --host1 $HOST1 --user1 toto \
  316. --passfile1 ../../var/pass/secret.toto \
  317. --host2 $HOST2 --user2 titi \
  318. --passfile2 ../../var/pass/secret.titi \
  319. --dry
  320. }
  321. first_sync() {
  322. $CMD_PERL ./imapsync \
  323. --host1 $HOST1 --user1 toto \
  324. --passfile1 ../../var/pass/secret.toto \
  325. --host2 $HOST2 --user2 titi \
  326. --passfile2 ../../var/pass/secret.titi
  327. }
  328. ll() {
  329. $CMD_PERL ./imapsync \
  330. --host1 $HOST1 --user1 tata \
  331. --passfile1 ../../var/pass/secret.tata \
  332. --host2 $HOST2 --user2 titi \
  333. --passfile2 ../../var/pass/secret.titi
  334. }
  335. ll_diff_log_stdout_debugssl() {
  336. $CMD_PERL ./imapsync \
  337. --host1 $HOST1 --user1 tata \
  338. --passfile1 ../../var/pass/secret.tata \
  339. --host2 $HOST2 --user2 titi \
  340. --passfile2 ../../var/pass/secret.titi \
  341. --justlogin --debugssl 4 \
  342. --logfile ll_diff_log_stdout_debugssl_1.txt 2>&1 \
  343. | tee LOG_imapsync/ll_diff_log_stdout_debugssl_2.txt
  344. echo
  345. diff LOG_imapsync/ll_diff_log_stdout_debugssl_1.txt LOG_imapsync/ll_diff_log_stdout_debugssl_2.txt
  346. }
  347. ll_INBOX() {
  348. $CMD_PERL ./imapsync \
  349. --host1 $HOST1 --user1 tata \
  350. --passfile1 ../../var/pass/secret.tata \
  351. --host2 $HOST2 --user2 titi \
  352. --passfile2 ../../var/pass/secret.titi \
  353. --folder INBOX
  354. }
  355. ll_daily_digest() {
  356. $CMD_PERL ./imapsync \
  357. --host1 $HOST1 --user1 tata \
  358. --passfile1 ../../var/pass/secret.tata \
  359. --host2 $HOST1 --user2 tata \
  360. --passfile2 ../../var/pass/secret.tata \
  361. --folder INBOX --dry --nodry1 --maxage 5 \
  362. --truncmess 1000 --debugcontent --f1f2 INBOX=INBOX.Fake \
  363. | egrep 'From:|To:|Subject:|Date:|=====|msg '
  364. }
  365. ll_acl() {
  366. $CMD_PERL ./imapsync \
  367. --host1 $HOST1 --user1 tata \
  368. --passfile1 ../../var/pass/secret.tata \
  369. --host2 $HOST2 --user2 titi \
  370. --passfile2 ../../var/pass/secret.titi \
  371. --folder INBOX.few_emails --syncacl # --debugimap # --dry
  372. }
  373. l_office365_acl()
  374. {
  375. $CMD_PERL ./imapsync \
  376. --host1 $HOST1 --user1 tata \
  377. --passfile1 ../../var/pass/secret.tata \
  378. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  379. --passfile2 ../../var/pass/secret.outlook.com \
  380. --folder INBOX.few_emails --syncacl --dry --debugimap
  381. }
  382. ll_namespace_debugimap() {
  383. $CMD_PERL ./imapsync \
  384. --host1 $HOST1 --user1 tata \
  385. --passfile1 ../../var/pass/secret.tata \
  386. --host2 $HOST2 --user2 titi \
  387. --passfile2 ../../var/pass/secret.titi \
  388. --debugimap1 --justfolderlists
  389. }
  390. ll_host_sanitize() {
  391. $CMD_PERL ./imapsync \
  392. --host1 " local /host " --user1 tata \
  393. --passfile1 ../../var/pass/secret.tata \
  394. --host2 ' loc alhost/ ' --user2 titi \
  395. --passfile2 ../../var/pass/secret.titi --justlogin
  396. }
  397. ll_skipcrossduplicates() {
  398. $CMD_PERL ./imapsync \
  399. --host1 $HOST1 --user1 tata \
  400. --passfile1 ../../var/pass/secret.tata \
  401. --host2 $HOST2 --user2 titi \
  402. --passfile2 ../../var/pass/secret.titi \
  403. --skipcrossduplicates --debugcrossduplicates
  404. }
  405. ll_append_debugimap() {
  406. sendtestmessage
  407. $CMD_PERL ./imapsync \
  408. --host1 $HOST1 --user1 tata \
  409. --passfile1 ../../var/pass/secret.tata \
  410. --host2 $HOST2 --user2 titi \
  411. --passfile2 ../../var/pass/secret.titi \
  412. --folder INBOX --maxage 1 --debugimap2 --nofoldersizes
  413. }
  414. ll_diff() {
  415. # sendtestmessage
  416. CMD_IMAPSYNC=./imapsync_old ll_tee LOG_imapsync/ll_diff_1.txt
  417. # sendtestmessage
  418. CMD_IMAPSYNC=./imapsync ll_tee LOG_imapsync/ll_diff_2.txt
  419. diff LOG_imapsync/ll_diff_1.txt LOG_imapsync/ll_diff_2.txt
  420. }
  421. ll_tee() {
  422. logfile=${1:-"LOG_imapsync/ll_tee.txt"}
  423. $CMD_PERL $CMD_IMAPSYNC \
  424. --host1 $HOST1 --user1 tata \
  425. --host2 $HOST2 --user2 titi \
  426. --passfile2 ../../var/pass/secret.titi \
  427. --folder INBOX.few_emails --password1 wrong | tee $logfile
  428. # --passfile1 ../../var/pass/secret.tata \
  429. }
  430. ll_minsize()
  431. {
  432. $CMD_PERL ./imapsync \
  433. --host1 $HOST1 --user1 tata \
  434. --passfile1 ../../var/pass/secret.tata \
  435. --host2 $HOST2 --user2 titi \
  436. --passfile2 ../../var/pass/secret.titi \
  437. --minsize 1000000 --folder INBOX
  438. }
  439. ll_nosearch()
  440. {
  441. $CMD_PERL ./imapsync \
  442. --host1 $HOST1 --user1 nosearch \
  443. --passfile1 ../../var/pass/secret.nosearch \
  444. --host2 $HOST2 --user2 titi \
  445. --passfile2 ../../var/pass/secret.titi
  446. }
  447. ll_search_larger() {
  448. $CMD_PERL ./imapsync \
  449. --host1 $HOST1 --user1 tata \
  450. --passfile1 ../../var/pass/secret.tata \
  451. --host2 $HOST2 --user2 titi \
  452. --passfile2 ../../var/pass/secret.titi \
  453. --search 'LARGER 1000' --folder INBOX
  454. }
  455. ll_search_keyword() {
  456. $CMD_PERL ./imapsync \
  457. --host1 $HOST1 --user1 tata \
  458. --passfile1 ../../var/pass/secret.tata \
  459. --host2 $HOST2 --user2 titi \
  460. --passfile2 ../../var/pass/secret.titi \
  461. --search 'KEYWORD NonJunk' --folder INBOX.flagsetSeen --debugflags --debugimap1
  462. }
  463. ll_maxsize() {
  464. $CMD_PERL ./imapsync \
  465. --host1 $HOST1 --user1 tata \
  466. --passfile1 ../../var/pass/secret.tata \
  467. --host2 $HOST2 --user2 titi \
  468. --passfile2 ../../var/pass/secret.titi \
  469. --maxsize 1000 --folder INBOX
  470. }
  471. ll_search_smaller() {
  472. $CMD_PERL ./imapsync \
  473. --host1 $HOST1 --user1 tata \
  474. --passfile1 ../../var/pass/secret.tata \
  475. --host2 $HOST2 --user2 titi \
  476. --passfile2 ../../var/pass/secret.titi \
  477. --search 'SMALLER 1000' --folder INBOX
  478. }
  479. kk_simulong() {
  480. $CMD_PERL ./imapsync \
  481. --testslive --simulong 30
  482. }
  483. # In mandatory_tests
  484. ll_sigreconnect_INT() {
  485. ( $CMD_PERL ./imapsync \
  486. --host1 $HOST1 --user1 tata \
  487. --passfile1 ../../var/pass/secret.tata \
  488. --host2 $HOST2 --user2 titi \
  489. --passfile2 ../../var/pass/secret.titi \
  490. --sigreconnect INT --simulong 30 \
  491. --pidfile /tmp/imapsync_tests_ll_sigreconnect_INT.pid
  492. echo status code when killing itself: $? # status code when killing itself?
  493. ) &
  494. echo ; sleep 2; echo ;
  495. kill -INT `head -1 /tmp/imapsync_tests_ll_sigreconnect_INT.pid`
  496. echo ; sleep 3; echo ;
  497. kill -INT `head -1 /tmp/imapsync_tests_ll_sigreconnect_INT.pid`
  498. echo ; sleep 3; echo ;
  499. kill -INT `head -1 /tmp/imapsync_tests_ll_sigreconnect_INT.pid`
  500. sleepenh 0.1
  501. kill -INT `head -1 /tmp/imapsync_tests_ll_sigreconnect_INT.pid`
  502. wait
  503. }
  504. ll_sigreconnect_CACA() {
  505. $CMD_PERL ./imapsync \
  506. --host1 $HOST1 --user1 tata \
  507. --passfile1 ../../var/pass/secret.tata \
  508. --host2 $HOST2 --user2 titi \
  509. --passfile2 ../../var/pass/secret.titi \
  510. --sigreconnect CACA --simulong 30
  511. }
  512. ll_sigreconnect_none() {
  513. $CMD_PERL ./imapsync \
  514. --host1 $HOST1 --user1 tata \
  515. --passfile1 ../../var/pass/secret.tata \
  516. --host2 $HOST2 --user2 titi \
  517. --passfile2 ../../var/pass/secret.titi \
  518. --sigreconnect '' --simulong 30
  519. }
  520. ll_sigignore_INT() {
  521. $CMD_PERL ./imapsync \
  522. --host1 $HOST1 --user1 tata \
  523. --passfile1 ../../var/pass/secret.tata \
  524. --host2 $HOST2 --user2 titi \
  525. --passfile2 ../../var/pass/secret.titi \
  526. --sigignore 'INT' --simulong 10
  527. }
  528. ll_sigignore_TERM() {
  529. $CMD_PERL ./imapsync \
  530. --host1 $HOST1 --user1 tata \
  531. --passfile1 ../../var/pass/secret.tata \
  532. --host2 $HOST2 --user2 titi \
  533. --passfile2 ../../var/pass/secret.titi \
  534. --sigignore 'TERM' --simulong 10
  535. }
  536. # ABORT tests
  537. # In mandatory_tests
  538. ll_abort_pidfile_no_exist()
  539. {
  540. $CMD_PERL ./imapsync \
  541. --host1 $HOST1 --user1 tata \
  542. --passfile1 ../../var/pass/secret.tata \
  543. --host2 $HOST2 --user2 titi \
  544. --passfile2 ../../var/pass/secret.titi \
  545. --abort --pidfile /noexist \
  546. --logfile ll_abort_pidfile_no_exist.log
  547. grep 'Can not read pidfile /noexist' LOG_imapsync/ll_abort_pidfile_no_exist.log
  548. }
  549. # In mandatory_tests
  550. ll_abort_noprocess()
  551. {
  552. # The process does not exist so the pidfile is removed so the abort is not done
  553. # and that is ok.
  554. echo 99998 > /tmp/imapsync_fake.pid
  555. $CMD_PERL ./imapsync \
  556. --host1 $HOST1 --user1 tata \
  557. --passfile1 ../../var/pass/secret.tata \
  558. --host2 $HOST2 --user2 titi \
  559. --passfile2 ../../var/pass/secret.titi \
  560. --abort --pidfile /tmp/imapsync_fake.pid \
  561. --logfile ll_abort_noprocess.log
  562. grep 'Removing old /tmp/imapsync_fake.pid since its PID 99998 is not running anymore' LOG_imapsync/ll_abort_noprocess.log
  563. }
  564. # In mandatory_tests
  565. ll_abort_not_a_pid_number()
  566. {
  567. echo 12345678 > /tmp/imapsync_fake.pid
  568. $CMD_PERL ./imapsync \
  569. --host1 $HOST1 --user1 tata \
  570. --passfile1 ../../var/pass/secret.tata \
  571. --host2 $HOST2 --user2 titi \
  572. --passfile2 ../../var/pass/secret.titi \
  573. --abort --pidfile /tmp/imapsync_fake.pid \
  574. --logfile ll_abort_not_a_pid_number.log
  575. grep 'pid 12345678 in /tmp/imapsync_fake.pid is not a pid number' LOG_imapsync/ll_abort_not_a_pid_number.log
  576. }
  577. # In mandatory_tests
  578. ll_abort_basic()
  579. {
  580. rm -f LOG_imapsync/imapsync_abortme.log
  581. $CMD_PERL ./imapsync \
  582. --host1 $HOST1 --user1 tata \
  583. --passfile1 ../../var/pass/secret.tata \
  584. --host2 $HOST2 --user2 titi \
  585. --passfile2 ../../var/pass/secret.titi \
  586. --pidfile /tmp/imapsync_abortme.pid \
  587. --logfile imapsync_abortme.log --simulong 4 &
  588. pid_imapsync_abortme=$!
  589. sleep 2
  590. # --abort send QUIT signal
  591. $CMD_PERL ./imapsync \
  592. --host1 $HOST1 --user1 tata \
  593. --passfile1 ../../var/pass/secret.tata \
  594. --host2 $HOST2 --user2 titi \
  595. --passfile2 ../../var/pass/secret.titi \
  596. --abort --pidfile /tmp/imapsync_abortme.pid \
  597. --logfile imapsync_aborter.log
  598. egrep 'Process PID .* ended.' LOG_imapsync/imapsync_aborter.log || return 1
  599. wait $pid_imapsync_abortme
  600. STATUS_pid_imapsync_abortme="$?"
  601. #test "$?" = "$EXIT_BY_SIGNAL" || return 1
  602. test "$STATUS_pid_imapsync_abortme" = "$EXIT_BY_SIGQUIT" || test "$STATUS_pid_imapsync_abortme" = "$EXIT_BY_SIGKILL" || return 1
  603. grep 'Killing myself with signal QUIT' LOG_imapsync/imapsync_abortme.log || return 1
  604. }
  605. # In mandatory_tests
  606. ll_abort_byfile_hand_made()
  607. {
  608. rm -f LOG_imapsync/imapsync_abortme.log
  609. $CMD_PERL ./imapsync \
  610. --host1 $HOST1 --user1 tata \
  611. --passfile1 ../../var/pass/secret.tata \
  612. --host2 $HOST2 --user2 titi \
  613. --passfile2 ../../var/pass/secret.titi \
  614. --pidfile /tmp/ll_abort_byfile_hand_made.pid --pidfilelocking \
  615. --logfile ll_abort_byfile_hand_made.log --simulong 4 &
  616. pid_imapsync_background=$!
  617. sleep 4
  618. touch "/tmp/ll_abort_byfile_hand_made.pidabort$pid_imapsync_background"
  619. wait $pid_imapsync_background
  620. test "$?" = "$EXIT_BY_FILE" || return 1
  621. ! test -f "/tmp/ll_abort_byfile_hand_made.pidabort$pid_imapsync_background" || return 1
  622. }
  623. # In mandatory_tests
  624. ll_abort_byfile_imapsync_made()
  625. {
  626. rm -f LOG_imapsync/ll_abort_byfile_imapsync_made.log
  627. $CMD_PERL ./imapsync \
  628. --host1 $HOST1 --user1 tata \
  629. --passfile1 ../../var/pass/secret.tata \
  630. --host2 $HOST2 --user2 titi \
  631. --passfile2 ../../var/pass/secret.titi \
  632. --pidfile /tmp/ll_abort_byfile_imapsync_made.pid --pidfilelocking \
  633. --logfile ll_abort_byfile_imapsync_made.log --simulong 6 --justbanner &
  634. pid_imapsync_background_2=$!
  635. sleep 3
  636. $CMD_PERL ./imapsync \
  637. --host1 $HOST1 --user1 tata \
  638. --passfile1 ../../var/pass/secret.tata \
  639. --host2 $HOST2 --user2 titi \
  640. --passfile2 ../../var/pass/secret.titi \
  641. --pidfile /tmp/ll_abort_byfile_imapsync_made.pid --pidfilelocking \
  642. --logfile ll_abort_byfile_imapsync_made_aborter.log --abortbyfile
  643. wait $pid_imapsync_background_2
  644. test "$?" = "$EXIT_BY_FILE" || return 1
  645. ! test -f "/tmp/imapsync_abortme_byfile.pidabort$pid_imapsync_background_2" || return 1
  646. }
  647. # In mandatory_tests
  648. ll_abort_byfile_normal_run()
  649. {
  650. rm -f LOG_imapsync/ll_abort_byfile_normal_run.log
  651. $CMD_PERL ./imapsync \
  652. --host1 $HOST1 --user1 tata \
  653. --passfile1 ../../var/pass/secret.tata \
  654. --host2 $HOST2 --user2 titi \
  655. --passfile2 ../../var/pass/secret.titi \
  656. --pidfile /tmp/ll_abort_byfile_normal_run.pid --pidfilelocking \
  657. --logfile ll_abort_byfile_normal_run.log --folder INBOX &
  658. pid_imapsync_background_3=$!
  659. sleep 3
  660. $CMD_PERL ./imapsync \
  661. --host1 $HOST1 --user1 tata \
  662. --passfile1 ../../var/pass/secret.tata \
  663. --host2 $HOST2 --user2 titi \
  664. --passfile2 ../../var/pass/secret.titi \
  665. --pidfile /tmp/ll_abort_byfile_normal_run.pid --pidfilelocking \
  666. --logfile ll_abort_byfile_normal_run_aborter.log --abortbyfile
  667. wait $pid_imapsync_background_3
  668. test "$?" = "$EXIT_BY_FILE" || return 1
  669. ! test -f "/tmp/imapsync_abortme_byfile.pidabort$pid_imapsync_background_3" || return 1
  670. }
  671. # In mandatory_tests
  672. ll_abort_cgi_context_tail() {
  673. # --tail mechanism will not be executed because --pidfile is not already created when tail is called.
  674. rm -f LOG_imapsync/imapsync_abortme.log
  675. $CMD_PERL ./imapsync \
  676. --host1 $HOST1 --user1 tata \
  677. --passfile1 ../../var/pass/secret.tata \
  678. --host2 $HOST2 --user2 titi \
  679. --passfile2 ../../var/pass/secret.titi \
  680. --pidfile /tmp/ll_abort_cgi_context_tail.pid --pidfilelocking --tail \
  681. --logfile ll_abort_cgi_context_tail.log --simulong 4 &
  682. sleep 2
  683. # --tail will be ignored because of --abort
  684. $CMD_PERL ./imapsync \
  685. --host1 $HOST1 --user1 tata \
  686. --passfile1 ../../var/pass/secret.tata \
  687. --host2 $HOST2 --user2 titi \
  688. --passfile2 ../../var/pass/secret.titi \
  689. --abort --pidfile /tmp/ll_abort_cgi_context_tail.pid --pidfilelocking --tail \
  690. --logfile ll_abort_cgi_context_tail_aborter.log
  691. egrep 'Process PID .* ended.' LOG_imapsync/ll_abort_cgi_context_tail_aborter.log || return 1
  692. grep 'Killing myself with signal QUIT' LOG_imapsync/ll_abort_cgi_context_tail.log || return 1
  693. }
  694. # In mandatory_tests
  695. ll_abort_no_pidfile_option() {
  696. # The final grep has to be fresh
  697. rm -f LOG_imapsync/ll_abort_no_pidfile_option.log
  698. $CMD_PERL ./imapsync \
  699. --host1 $HOST1 --user1 tata \
  700. --passfile1 ../../var/pass/secret.tata \
  701. --host2 $HOST2 --user2 titi \
  702. --passfile2 ../../var/pass/secret.titi \
  703. --logfile ll_abort_no_pidfile_option.log &
  704. sleep 10
  705. $CMD_PERL ./imapsync \
  706. --host1 $HOST1 --user1 tata \
  707. --passfile1 ../../var/pass/secret.tata \
  708. --host2 $HOST2 --user2 titi \
  709. --passfile2 ../../var/pass/secret.titi \
  710. --abort \
  711. --logfile ll_abort_no_pidfile_option_aborter.log
  712. egrep 'Process PID .* ended.' LOG_imapsync/ll_abort_no_pidfile_option_aborter.log || return 1
  713. grep 'Killing myself with signal QUIT' LOG_imapsync/ll_abort_no_pidfile_option.log || return 1
  714. }
  715. abort_tests()
  716. {
  717. ll_abort_pidfile_no_exist \
  718. && ll_abort_noprocess \
  719. && ll_abort_not_a_pid_number \
  720. && ll_abort_basic \
  721. && ll_abort_cgi_context_tail \
  722. && ll_abort_no_pidfile_option \
  723. && ll_abort_byfile_hand_made \
  724. && ll_abort_byfile_imapsync_made \
  725. && ll_abort_byfile_normal_run
  726. }
  727. ll_simulong() {
  728. $CMD_PERL ./imapsync \
  729. --host1 $HOST1 --user1 tata \
  730. --passfile1 ../../var/pass/secret.tata \
  731. --host2 $HOST2 --user2 titi \
  732. --passfile2 ../../var/pass/secret.titi \
  733. --justbanner --simulong 5
  734. }
  735. ll_nouid1() {
  736. can_send && sendtestmessage
  737. $CMD_PERL ./imapsync \
  738. --host1 $HOST1 --user1 tata \
  739. --passfile1 ../../var/pass/secret.tata \
  740. --host2 $HOST2 --user2 titi \
  741. --passfile2 ../../var/pass/secret.titi \
  742. --nouid1 --folder INBOX # --debugimap1
  743. }
  744. ll_eta() {
  745. can_send && sendtestmessage
  746. can_send && sendtestmessage
  747. $CMD_PERL ./imapsync \
  748. --host1 $HOST1 --user1 tata \
  749. --passfile1 ../../var/pass/secret.tata \
  750. --host2 $HOST2 --user2 titi \
  751. --passfile2 ../../var/pass/secret.titi \
  752. --folder INBOX
  753. }
  754. ll_final_diff() {
  755. can_send && sendtestmessage
  756. can_send && sendtestmessage
  757. $CMD_PERL ./imapsync \
  758. --host1 $HOST1 --user1 tata \
  759. --passfile1 ../../var/pass/secret.tata \
  760. --host2 $HOST2 --user2 titi \
  761. --passfile2 ../../var/pass/secret.titi \
  762. --folder INBOX --f1f2 INBOX=INBOX.final_diff --maxage 30
  763. }
  764. ll_with_flags_errors() {
  765. can_send && sendtestmessage
  766. can_send && sendtestmessage
  767. $CMD_PERL ./imapsync \
  768. --host1 $HOST1 --user1 tata \
  769. --passfile1 ../../var/pass/secret.tata \
  770. --host2 $HOST2 --user2 titi \
  771. --passfile2 ../../var/pass/secret.titi \
  772. --folder INBOX --maxage 300 \
  773. --regexflag 's/.*/PasGlop \\PasGlopRe/' --errorsmax 5
  774. test "$EXIT_ERR_FLAGS" = "$?"
  775. }
  776. ll_errorsmax() {
  777. $CMD_PERL ./imapsync \
  778. --host1 $HOST1 --user1 tata \
  779. --passfile1 ../../var/pass/secret.tata \
  780. --host2 $HOST2 --user2 titi \
  781. --passfile2 ../../var/pass/secret.titi \
  782. --nofoldersizes --folder INBOX.errors --regexflag 's/.*/PasGlop \\PasGlopRe/' --errorsmax 5 \
  783. | grep 'Maximum number of errors 5 reached'
  784. #--pipemess 'grep lalalala' --nopipemesscheck --dry --debugcontent --debugflags
  785. #test "$EXIT_WITH_ERRORS_MAX" = "$?" # no longer used since errors classification
  786. #test "$EXIT_ERR_FLAGS" = "$?"
  787. }
  788. ll_debug()
  789. {
  790. $CMD_PERL ./imapsync \
  791. --host1 $HOST1 --user1 tata \
  792. --passfile1 ../../var/pass/secret.tata \
  793. --host2 $HOST2 --user2 titi \
  794. --passfile2 ../../var/pass/secret.titi \
  795. --debug
  796. }
  797. ll_debugcontent() {
  798. can_send && sendtestmessage
  799. $CMD_PERL ./imapsync \
  800. --host1 $HOST1 --user1 tata \
  801. --passfile1 ../../var/pass/secret.tata \
  802. --host2 $HOST2 --user2 titi \
  803. --passfile2 ../../var/pass/secret.titi \
  804. --debugcontent --maxage 1 --folder INBOX --dry --nodry1
  805. }
  806. ll_debug_FETCH_BODY() {
  807. #can_send && sendtestmessage
  808. $CMD_PERL ./imapsync \
  809. --host1 $HOST1 --user1 tata \
  810. --passfile1 ../../var/pass/secret.tata \
  811. --host2 $HOST2 --user2 titi \
  812. --passfile2 ../../var/pass/secret.titi \
  813. --debugimap1 --maxage 1 --folder INBOX --dry --nodry1
  814. }
  815. ll_debugmemory() {
  816. sendtestmessage
  817. $CMD_PERL ./imapsync \
  818. --host1 $HOST1 --user1 tata \
  819. --passfile1 ../../var/pass/secret.tata \
  820. --host2 $HOST2 --user2 titi \
  821. --passfile2 ../../var/pass/secret.titi \
  822. --debugmemory --nofoldersizes --folder INBOX
  823. }
  824. ll_justfolderlists()
  825. {
  826. $CMD_PERL ./imapsync \
  827. --host1 $HOST1 --user1 tata \
  828. --passfile1 ../../var/pass/secret.tata \
  829. --host2 $HOST2 --user2 titi \
  830. --passfile2 ../../var/pass/secret.titi \
  831. --checkselectable --justfolderlists
  832. }
  833. ll_checkselectable()
  834. {
  835. $CMD_PERL ./imapsync \
  836. --host1 $HOST1 --user1 tata \
  837. --passfile1 ../../var/pass/secret.tata \
  838. --host2 $HOST2 --user2 titi \
  839. --passfile2 ../../var/pass/secret.titi \
  840. --checkselectable --debugimap1 --justfolderlists \
  841. | grep 'is selectable'
  842. }
  843. ll_nocheckselectable()
  844. {
  845. $CMD_PERL ./imapsync \
  846. --host1 $HOST1 --user1 tata \
  847. --passfile1 ../../var/pass/secret.tata \
  848. --host2 $HOST2 --user2 titi \
  849. --passfile2 ../../var/pass/secret.titi \
  850. --nocheckselectable --justfolderlists \
  851. | grep 'Not checking that .*wanted folders are selectable'
  852. }
  853. ll_checkselectable_nb_folders()
  854. {
  855. $CMD_PERL ./imapsync \
  856. --host1 $HOST1 --user1 tata \
  857. --passfile1 ../../var/pass/secret.tata \
  858. --host2 $HOST2 --user2 titi \
  859. --passfile2 ../../var/pass/secret.titi \
  860. --justfolderlists | grep 'Not checking that .* wanted folders are selectable'
  861. }
  862. ll_checkfoldersexist()
  863. {
  864. $CMD_PERL ./imapsync \
  865. --host1 $HOST1 --user1 tata \
  866. --passfile1 ../../var/pass/secret.tata \
  867. --host2 $HOST2 --user2 titi \
  868. --passfile2 ../../var/pass/secret.titi \
  869. --checkfoldersexist --debug --justfolderlists \
  870. | grep -i 'checking'
  871. }
  872. ll_nocheckfoldersexist()
  873. {
  874. $CMD_PERL ./imapsync \
  875. --host1 $HOST1 --user1 tata \
  876. --passfile1 ../../var/pass/secret.tata \
  877. --host2 $HOST2 --user2 titi \
  878. --passfile2 ../../var/pass/secret.titi \
  879. --nocheckfoldersexist --justfolderlists \
  880. | grep -i 'Not checking that wanted folders exist'
  881. }
  882. ll_nofoldersizes()
  883. {
  884. $CMD_PERL ./imapsync \
  885. --host1 $HOST1 --user1 tata \
  886. --passfile1 ../../var/pass/secret.tata \
  887. --host2 $HOST2 --user2 titi \
  888. --passfile2 ../../var/pass/secret.titi \
  889. --nofoldersizes --folder INBOX
  890. }
  891. ll_nofoldersizes_foldersizesatend()
  892. {
  893. $CMD_PERL ./imapsync \
  894. --host1 $HOST1 --user1 tata \
  895. --passfile1 ../../var/pass/secret.tata \
  896. --host2 $HOST2 --user2 titi \
  897. --passfile2 ../../var/pass/secret.titi \
  898. --nofoldersizes --foldersizesatend --folder INBOX
  899. }
  900. pidfile_well_removed() {
  901. $CMD_PERL ./imapsync \
  902. --justbanner \
  903. --pidfile /var/tmp/imapsync.pid
  904. test "$?" = "$EX_OK" || return 1
  905. ! test -f /var/tmp/imapsync.pid
  906. }
  907. pidfile_bad() {
  908. $CMD_PERL ./imapsync \
  909. --justbanner \
  910. --pidfile /var/tmp/noexist/imapsync.pid
  911. test "$?" = "$EXIT_PID_FILE_ERROR"
  912. }
  913. ll_skipcrossduplicates_usecache() {
  914. $CMD_PERL ./imapsync \
  915. --host1 $HOST1 --user1 tata \
  916. --passfile1 ../../var/pass/secret.tata \
  917. --host2 $HOST2 --user2 titi \
  918. --passfile2 ../../var/pass/secret.titi \
  919. --skipcrossduplicates --usecache
  920. test "$?" = "$EX_USAGE"
  921. }
  922. test_tail() {
  923. $CMD_PERL ./imapsync \
  924. --justbanner --simulong 15 \
  925. --pidfile /var/tmp/imapsync_tail_tests.pid \
  926. --pidfilelocking &
  927. sleep 1
  928. $CMD_PERL ./imapsync \
  929. --justbanner \
  930. --pidfile /var/tmp/imapsync_tail_tests.pid \
  931. --pidfilelocking --tail
  932. }
  933. ll_pidfilelocking() {
  934. rm -f /var/tmp/imapsync_test_pidfilelocking.pid
  935. echo ll_pidfilelocking 01 lockfile is not previously there
  936. $CMD_PERL ./imapsync --justbanner \
  937. --pidfile /var/tmp/imapsync_test_pidfilelocking.pid \
  938. --pidfilelocking || return 1
  939. echo ll_pidfilelocking 02 lockfile normally removed
  940. ! test -f /var/tmp/imapsync_test_pidfilelocking.pid || return 1
  941. echo ll_pidfilelocking 03 lockfile created before
  942. touch /var/tmp/imapsync_test_pidfilelocking.pid || return 1
  943. echo ll_pidfilelocking 04 lockfile already there but not with a PID number
  944. ! $CMD_PERL ./imapsync --justbanner \
  945. --pidfile /var/tmp/imapsync_test_pidfilelocking.pid \
  946. --pidfilelocking || return 1
  947. echo ll_pidfilelocking 05 lockfile still there
  948. test -f /var/tmp/imapsync_test_pidfilelocking.pid || return 1
  949. echo ll_pidfilelocking 06 filling lockfile with 33333
  950. echo 33333 > /var/tmp/imapsync_test_pidfilelocking.pid
  951. echo ll_pidfilelocking 07 lockfile already there with fake PID in it, imapsync will remove it and generate a new one.
  952. $CMD_PERL ./imapsync --justbanner \
  953. --pidfile /var/tmp/imapsync_test_pidfilelocking.pid \
  954. --pidfilelocking || return 1
  955. echo ll_pidfilelocking 08 lockfile should be removed now
  956. ! test -f /var/tmp/imapsync_test_pidfilelocking.pid || return 1
  957. }
  958. justbanner() {
  959. $CMD_PERL ./imapsync \
  960. --justbanner
  961. }
  962. nomodules_version() {
  963. $CMD_PERL ./imapsync \
  964. --justbanner \
  965. --nomodules_version
  966. }
  967. ll_ask_password() {
  968. {
  969. sleep 2; cat ../../var/pass/secret.tata;
  970. sleep 2; cat ../../var/pass/secret.titi;
  971. } | \
  972. $CMD_PERL ./imapsync \
  973. --host1 $HOST1 --user1 tata \
  974. --host2 $HOST2 --user2 titi \
  975. --justlogin
  976. }
  977. ll_env_password() {
  978. set +x
  979. IMAPSYNC_PASSWORD1=`cat ../../var/pass/secret.tata` \
  980. IMAPSYNC_PASSWORD2=`cat ../../var/pass/secret.titi` \
  981. $CMD_PERL ./imapsync \
  982. --host1 $HOST1 --user1 tata \
  983. --host2 $HOST2 --user2 titi --passfile2 ../../var/pass/secret.titi \
  984. --justlogin
  985. }
  986. ll_authmech_PREAUTH() {
  987. # No PREAUTH on my box
  988. $CMD_PERL ./imapsync \
  989. --host1 $HOST1 --user1 tata --authmech1 PREAUTH \
  990. --host2 $HOST2 --user2 titi \
  991. --passfile2 ../../var/pass/secret.titi \
  992. --justlogin --debugimap1
  993. test "$?" = "$EXIT_AUTHENTICATION_FAILURE"
  994. }
  995. ll_unknow_option() {
  996. ! $CMD_PERL ./imapsync \
  997. --host1 $HOST1 --user1 tata \
  998. --passfile1 ../../var/pass/secret.tata \
  999. --host2 $HOST2 --user2 titi \
  1000. --passfile2 ../../var/pass/secret.titi \
  1001. --folder INBOX --unknow_option
  1002. }
  1003. ll_timeout() {
  1004. $CMD_PERL ./imapsync \
  1005. --host1 $HOST1 --user1 tata \
  1006. --passfile1 ../../var/pass/secret.tata \
  1007. --host2 $HOST2 --user2 titi \
  1008. --passfile2 ../../var/pass/secret.titi \
  1009. --folder INBOX --timeout 4.99 --justlogin
  1010. }
  1011. ll_timeout1_timeout2() {
  1012. $CMD_PERL ./imapsync \
  1013. --host1 $HOST1 --user1 tata \
  1014. --passfile1 ../../var/pass/secret.tata \
  1015. --host2 $HOST2 --user2 titi \
  1016. --passfile2 ../../var/pass/secret.titi \
  1017. --folder INBOX --timeout1 1.99 --timeout2 1.95 --justlogin
  1018. }
  1019. ll_timeout_timeout1() {
  1020. $CMD_PERL ./imapsync \
  1021. --host1 $HOST1 --user1 tata \
  1022. --passfile1 ../../var/pass/secret.tata \
  1023. --host2 $HOST2 --user2 titi \
  1024. --passfile2 ../../var/pass/secret.titi \
  1025. --folder INBOX --timeout1 5 --timeout 4 --justlogin
  1026. }
  1027. ll_timeout_very_small() {
  1028. ! $CMD_PERL ./imapsync \
  1029. --host1 $HOST1 --user1 tata \
  1030. --passfile1 ../../var/pass/secret.tata \
  1031. --host2 $HOST2 --user2 titi \
  1032. --passfile2 ../../var/pass/secret.titi \
  1033. --folder INBOX --timeout 0.001 --nossl1 --nossl2 --notls1 --notls2 --justlogin
  1034. }
  1035. ll_folder() {
  1036. $CMD_PERL ./imapsync \
  1037. --host1 $HOST1 --user1 tata \
  1038. --passfile1 ../../var/pass/secret.tata \
  1039. --host2 $HOST2 --user2 titi \
  1040. --passfile2 ../../var/pass/secret.titi \
  1041. --folder INBOX.yop --folder INBOX.Trash
  1042. }
  1043. ll_backstar() {
  1044. $CMD_PERL ./imapsync \
  1045. --host1 $HOST1 --user1 tata \
  1046. --passfile1 ../../var/pass/secret.tata \
  1047. --host2 $HOST2 --user2 titi \
  1048. --passfile2 ../../var/pass/secret.titi \
  1049. --folder 'INBOX.backstar\*' --dry --justfolders --debugimap1 --regextrans2 's#\\|\*#_#g'
  1050. }
  1051. ll_star() {
  1052. $CMD_PERL ./imapsync \
  1053. --host1 $HOST1 --user1 tata \
  1054. --passfile1 ../../var/pass/secret.tata \
  1055. --host2 $HOST2 --user2 titi \
  1056. --passfile2 ../../var/pass/secret.titi \
  1057. --folder 'INBOX.star*' --justfolders --debugimap
  1058. }
  1059. ll_star_ch() {
  1060. $CMD_PERL ./imapsync \
  1061. --host1 $HOST1 --user1 tata \
  1062. --passfile1 ../../var/pass/secret.tata \
  1063. --host2 $HOST2 --user2 titi \
  1064. --passfile2 ../../var/pass/secret.titi \
  1065. --folderrec 'INBOX.Z_ch' --justfolders --debugimap
  1066. }
  1067. ll_tr() {
  1068. $CMD_PERL ./imapsync \
  1069. --host1 $HOST1 --user1 tata \
  1070. --passfile1 ../../var/pass/secret.tata \
  1071. --host2 $HOST2 --user2 titi \
  1072. --passfile2 ../../var/pass/secret.titi \
  1073. --dry --justfolders --include a --regextrans2 'tr/a/_/'
  1074. }
  1075. ll_tr_delete() {
  1076. $CMD_PERL ./imapsync \
  1077. --host1 $HOST1 --user1 tata \
  1078. --passfile1 ../../var/pass/secret.tata \
  1079. --host2 $HOST2 --user2 titi \
  1080. --passfile2 ../../var/pass/secret.titi \
  1081. --dry --justfolders --folder INBOX.lalala --regextrans2 'tr/a//d'
  1082. }
  1083. ll_regextrans2_d() {
  1084. $CMD_PERL ./imapsync \
  1085. --host1 $HOST1 --user1 tata \
  1086. --passfile1 ../../var/pass/secret.tata \
  1087. --host2 $HOST2 --user2 titi \
  1088. --passfile2 ../../var/pass/secret.titi \
  1089. --dry --justfolders --regextrans2 's,INBOX\.,,'
  1090. }
  1091. lks_trailing_space() {
  1092. $CMD_PERL ./imapsync \
  1093. --host1 $HOST1 --user1 tata \
  1094. --passfile1 ../../var/pass/secret.tata \
  1095. --host2 ks.lamiral.info --user2 tata \
  1096. --passfile2 ../../var/pass/secret.tata \
  1097. --justfolders --ssl1 --ssl2
  1098. }
  1099. lks_doublequote() {
  1100. $CMD_PERL ./imapsync \
  1101. --host1 $HOST1 --user1 tata \
  1102. --passfile1 ../../var/pass/secret.tata \
  1103. --host2 ks.lamiral.info --user2 tata \
  1104. --passfile2 ../../var/pass/secret.tata \
  1105. --folder 'INBOX."uni"' --debugimap2 --nofoldersizes --justfolders --ssl1 --ssl2
  1106. }
  1107. lks_doublequote_rev() {
  1108. $CMD_PERL ./imapsync \
  1109. --host1 ks.lamiral.info --user1 tata \
  1110. --passfile1 ../../var/pass/secret.tata \
  1111. --host2 $HOST2 --user2 tata \
  1112. --passfile2 ../../var/pass/secret.tata \
  1113. --foldersizes --ssl1 --ssl2 --justfolders
  1114. }
  1115. ksks_password_doublequote() {
  1116. $CMD_PERL ./imapsync \
  1117. --host1 ks.lamiral.info --user1 test1 \
  1118. --password1 'secret1' \
  1119. --host2 ks.lamiral.info --user2 test1 \
  1120. --password2 '"secret1"' \
  1121. --debugimap --justlogin --showpasswords
  1122. }
  1123. ksks_empty_test1()
  1124. {
  1125. $CMD_PERL ./imapsync \
  1126. --host1 test1.lamiral.info --user1 test1 \
  1127. --password1 'secret1' \
  1128. --host2 test1.lamiral.info --user2 test1 \
  1129. --password2 'secret1' \
  1130. --delete1 --delete1emptyfolders
  1131. }
  1132. ksks_init_test1()
  1133. {
  1134. $CMD_PERL ./imapsync \
  1135. --host1 $HOST1 --user1 tata \
  1136. --passfile1 ../../var/pass/secret.tata \
  1137. --host2 test1.lamiral.info --user2 test1 \
  1138. --password2 'secret1' \
  1139. --folder INBOX.init --f1f2 INBOX.init=INBOX \
  1140. --folderrec 'INBOX.init'
  1141. }
  1142. # In mandatory_tests
  1143. ksks_reset_test1()
  1144. {
  1145. ksks_empty_test1
  1146. ksks_init_test1
  1147. }
  1148. ksks_empty_test2() {
  1149. $CMD_PERL ./imapsync \
  1150. --host1 test2.lamiral.info --user1 test2 \
  1151. --password1 'secret2' \
  1152. --host2 test2.lamiral.info --user2 test2 \
  1153. --password2 'secret2' \
  1154. --delete1 --delete1emptyfolders
  1155. }
  1156. ll_folder_noexist() {
  1157. $CMD_PERL ./imapsync \
  1158. --host1 $HOST1 --user1 tata \
  1159. --passfile1 ../../var/pass/secret.tata \
  1160. --host2 $HOST2 --user2 titi \
  1161. --passfile2 ../../var/pass/secret.titi \
  1162. --folder INBOX.noexist --folder INBOX.noexist2
  1163. }
  1164. ll_folder_mixfolders() {
  1165. $CMD_PERL ./imapsync \
  1166. --host1 $HOST1 --user1 tata \
  1167. --passfile1 ../../var/pass/secret.tata \
  1168. --host2 $HOST2 --user2 titi \
  1169. --passfile2 ../../var/pass/secret.titi \
  1170. --mixfolders --justfolders --nofoldersizes
  1171. }
  1172. # Way to check it each time:
  1173. # sh -x tests.sh ll_folder_create ll_delete2folders
  1174. # In mandatory_tests
  1175. ll_folder_create() {
  1176. $CMD_PERL ./imapsync \
  1177. --host1 $HOST1 --user1 tata \
  1178. --passfile1 ../../var/pass/secret.tata \
  1179. --host2 $HOST2 --user2 titi \
  1180. --passfile2 ../../var/pass/secret.titi \
  1181. --folder INBOX.yop --regextrans2 's/yop/new.nested.yop/' \
  1182. --justfolders
  1183. }
  1184. # In mandatory_tests
  1185. ll_folder_create_INBOX_Inbox() {
  1186. $CMD_PERL ./imapsync \
  1187. --host1 $HOST1 --user1 tata \
  1188. --passfile1 ../../var/pass/secret.tata \
  1189. --host2 $HOST2 --user2 titi \
  1190. --passfile2 ../../var/pass/secret.titi \
  1191. --folder INBOX --regextrans2 's/INBOX/Inbox/' \
  1192. --justfolders --nofoldersizes
  1193. }
  1194. ll_folder_create_backslash_backslash() {
  1195. $CMD_PERL ./imapsync \
  1196. --host1 $HOST1 --user1 tata \
  1197. --passfile1 ../../var/pass/secret.tata \
  1198. --host2 $HOST2 --user2 titi \
  1199. --passfile2 ../../var/pass/secret.titi \
  1200. --folder INBOX.yop.yap.yip --regextrans2 's/yop/newyop/' \
  1201. --sep2 '\\' \
  1202. --justfolders --nofoldersizes --dry
  1203. }
  1204. ll_folder_domino() {
  1205. $CMD_PERL ./imapsync \
  1206. --host1 $HOST1 --user1 tata \
  1207. --passfile1 ../../var/pass/secret.tata \
  1208. --host2 $HOST2 --user2 titi \
  1209. --passfile2 ../../var/pass/secret.titi \
  1210. --folder INBOX.yop.yap.yip --regextrans2 's/yop/newyop/' \
  1211. --sep2 '\' --prefix2 '' --prefix1 '' \
  1212. --regextrans2 's,^Inbox\\(.*),$1,i' \
  1213. --justfolders --dry --debug
  1214. }
  1215. ll_folder_domino_sub() {
  1216. $CMD_PERL ./imapsync \
  1217. --host1 $HOST1 --user1 tata \
  1218. --passfile1 ../../var/pass/secret.tata \
  1219. --host2 $HOST2 --user2 titi \
  1220. --passfile2 ../../var/pass/secret.titi \
  1221. --folder INBOX.yop.yap.yip --regextrans2 's/yop/newyop/' \
  1222. --sep2 '\' --prefix2 '' \
  1223. --subfolder2 'OLDBOX' \
  1224. --justfolders --dry --debug
  1225. }
  1226. # In mandatory_tests
  1227. ll_domino2() {
  1228. $CMD_PERL ./imapsync \
  1229. --host1 $HOST1 --user1 tata \
  1230. --passfile1 ../../var/pass/secret.tata \
  1231. --host2 $HOST2 --user2 titi \
  1232. --passfile2 ../../var/pass/secret.titi \
  1233. --folder INBOX.yop.yap.yip --regextrans2 's/yop/newyop/' \
  1234. --domino2 \
  1235. --subfolder2 'OLDBOX' \
  1236. --justfolders --dry --debug
  1237. }
  1238. # In mandatory_tests
  1239. ll_domino1_domino2() {
  1240. $CMD_PERL ./imapsync \
  1241. --host1 $HOST1 --user1 tata \
  1242. --passfile1 ../../var/pass/secret.tata \
  1243. --host2 $HOST2 --user2 titi \
  1244. --passfile2 ../../var/pass/secret.titi \
  1245. --folder INBOX.yop.yap.yip --regextrans2 's/yop/newyop/' \
  1246. --domino1 --domino2 \
  1247. --subfolder2 'OLDBOX' \
  1248. --justfolders --dry
  1249. }
  1250. ll_oneemail() {
  1251. $CMD_PERL ./imapsync \
  1252. --host1 $HOST1 --user1 tata \
  1253. --passfile1 ../../var/pass/secret.tata \
  1254. --host2 $HOST2 --user2 titi \
  1255. --passfile2 ../../var/pass/secret.titi \
  1256. --folder INBOX.oneemail
  1257. }
  1258. ll_debugimap() {
  1259. $CMD_PERL ./imapsync \
  1260. --host1 $HOST1 --user1 tata \
  1261. --passfile1 ../../var/pass/secret.tata \
  1262. --host2 $HOST2 --user2 titi \
  1263. --passfile2 ../../var/pass/secret.titi \
  1264. --folder INBOX.oneemail --debugimap --justlogin
  1265. }
  1266. ll_few_emails() {
  1267. $CMD_PERL ./imapsync \
  1268. --host1 $HOST1 --user1 tata \
  1269. --passfile1 ../../var/pass/secret.tata \
  1270. --host2 $HOST2 --user2 titi \
  1271. --passfile2 ../../var/pass/secret.titi \
  1272. --folder INBOX.few_emails
  1273. }
  1274. ll_few_emails_dev() {
  1275. $CMD_PERL ./imapsync \
  1276. --host1 $HOST1 --user1 tata \
  1277. --passfile1 ../../var/pass/secret.tata \
  1278. --host2 $HOST2 --user2 titi \
  1279. --passfile2 ../../var/pass/secret.titi \
  1280. --folder INBOX.few_emails --nofoldersizes
  1281. }
  1282. ll_pipemess() {
  1283. $CMD_PERL ./imapsync \
  1284. --host1 $HOST1 --user1 tata \
  1285. --passfile1 ../../var/pass/secret.tata \
  1286. --host2 $HOST2 --user2 titi \
  1287. --passfile2 ../../var/pass/secret.titi \
  1288. --folder INBOX.few_emails --pipemess 'cat' --pipemess 'reformime -r7'
  1289. cmd_status=$?
  1290. echo "sudo rm -rf /home/vmail/titi/.few_emails/"
  1291. return $cmd_status
  1292. }
  1293. ll_pipemess_catcat() {
  1294. $CMD_PERL ./imapsync \
  1295. --host1 $HOST1 --user1 tata \
  1296. --passfile1 ../../var/pass/secret.tata \
  1297. --host2 $HOST2 --user2 titi \
  1298. --passfile2 ../../var/pass/secret.titi \
  1299. --folder INBOX.few_emails --pipemess '(cat|cat)' --pipemess 'reformime -r7'
  1300. cmd_status=$?
  1301. echo "sudo rm -rf /home/vmail/titi/.few_emails/"
  1302. return $cmd_status
  1303. }
  1304. ll_pipemess_nocmd() {
  1305. ! $CMD_PERL ./imapsync \
  1306. --host1 $HOST1 --user1 tata \
  1307. --passfile1 ../../var/pass/secret.tata \
  1308. --host2 $HOST2 --user2 titi \
  1309. --passfile2 ../../var/pass/secret.titi \
  1310. --folder INBOX.few_emails --pipemess 'nocat'
  1311. echo "sudo rm -rf /home/vmail/titi/.few_emails/"
  1312. }
  1313. ll_pipemess_false() {
  1314. ! $CMD_PERL ./imapsync \
  1315. --host1 $HOST1 --user1 tata \
  1316. --passfile1 ../../var/pass/secret.tata \
  1317. --host2 $HOST2 --user2 titi \
  1318. --passfile2 ../../var/pass/secret.titi \
  1319. --folder INBOX.few_emails --pipemess '/bin/false' --nopipemesscheck
  1320. echo "sudo rm -rf /home/vmail/titi/.few_emails/"
  1321. }
  1322. ll_pipemess_true() {
  1323. ! $CMD_PERL ./imapsync \
  1324. --host1 $HOST1 --user1 tata \
  1325. --passfile1 ../../var/pass/secret.tata \
  1326. --host2 $HOST2 --user2 titi \
  1327. --passfile2 ../../var/pass/secret.titi \
  1328. --folder INBOX.few_emails --pipemess '/bin/true'
  1329. echo "sudo rm -rf /home/vmail/titi/.few_emails/"
  1330. }
  1331. ll_size_null() {
  1332. $CMD_PERL ./imapsync \
  1333. --host1 $HOST1 --user1 tata \
  1334. --passfile1 ../../var/pass/secret.tata \
  1335. --host2 $HOST2 --user2 titi \
  1336. --passfile2 ../../var/pass/secret.titi \
  1337. --folder INBOX.size_null
  1338. }
  1339. # In mandatory_tests
  1340. ll_noheader() {
  1341. $CMD_PERL ./imapsync \
  1342. --host1 $HOST1 --user1 tata \
  1343. --passfile1 ../../var/pass/secret.tata \
  1344. --host2 $HOST2 --user2 titi \
  1345. --passfile2 ../../var/pass/secret.titi \
  1346. --folder INBOX.few_emails --useheader '' --debug
  1347. }
  1348. # In mandatory_tests
  1349. ll_noheader_force() {
  1350. $CMD_PERL ./imapsync \
  1351. --host1 $HOST1 --user1 tata \
  1352. --passfile1 ../../var/pass/secret.tata \
  1353. --host2 $HOST2 --user2 titi \
  1354. --passfile2 ../../var/pass/secret.titi \
  1355. --folder INBOX.few_emails \
  1356. --useheader '' \
  1357. --skipheader 'Message-Id|Date'
  1358. }
  1359. ll_addheader() {
  1360. $CMD_PERL ./imapsync \
  1361. --host1 $HOST1 --user1 tata \
  1362. --passfile1 ../../var/pass/secret.tata \
  1363. --host2 $HOST2 --user2 titi \
  1364. --passfile2 ../../var/pass/secret.titi \
  1365. --folder INBOX.addheader --delete2
  1366. # destination should be empty
  1367. ! ls /home/vmail/titi/.addheader/cur/* || return 1
  1368. $CMD_PERL ./imapsync \
  1369. --host1 $HOST1 --user1 tata \
  1370. --passfile1 ../../var/pass/secret.tata \
  1371. --host2 $HOST2 --user2 titi \
  1372. --passfile2 ../../var/pass/secret.titi \
  1373. --folder INBOX.addheader --delete2 --addheader
  1374. # Now it should be not empty
  1375. ls /home/vmail/titi/.addheader/cur/* || return 1
  1376. }
  1377. ll_addheader_minage() {
  1378. $CMD_PERL ./imapsync \
  1379. --host1 $HOST1 --user1 tata \
  1380. --passfile1 ../../var/pass/secret.tata \
  1381. --host2 $HOST2 --user2 titi \
  1382. --passfile2 ../../var/pass/secret.titi \
  1383. --folder INBOX.addheader --delete2
  1384. # destination should be empty
  1385. ! ls /home/vmail/titi/.addheader/cur/* || return 1
  1386. $CMD_PERL ./imapsync \
  1387. --host1 $HOST1 --user1 tata \
  1388. --passfile1 ../../var/pass/secret.tata \
  1389. --host2 $HOST2 --user2 titi \
  1390. --passfile2 ../../var/pass/secret.titi \
  1391. --folder INBOX.addheader --delete2 --addheader --minage 365 --debugimap
  1392. # Now it should be not empty
  1393. ls /home/vmail/titi/.addheader/cur/* || return 1
  1394. }
  1395. ll_usecachemaxage() {
  1396. $CMD_PERL ./imapsync \
  1397. --host1 $HOST1 --user1 tata \
  1398. --passfile1 ../../var/pass/secret.tata \
  1399. --host2 $HOST2 --user2 titi \
  1400. --passfile2 ../../var/pass/secret.titi \
  1401. --useuid --maxage 3
  1402. }
  1403. ll_folderrec() {
  1404. $CMD_PERL ./imapsync \
  1405. --host1 $HOST1 --user1 tata \
  1406. --passfile1 ../../var/pass/secret.tata \
  1407. --host2 $HOST2 --user2 titi \
  1408. --passfile2 ../../var/pass/secret.titi \
  1409. --folderrec INBOX.yop --justfolders
  1410. }
  1411. ll_folderrec_INBOX() {
  1412. $CMD_PERL ./imapsync \
  1413. --host1 $HOST1 --user1 tata \
  1414. --passfile1 ../../var/pass/secret.tata \
  1415. --host2 $HOST2 --user2 titi \
  1416. --passfile2 ../../var/pass/secret.titi \
  1417. --folderrec INBOX --justfolders
  1418. }
  1419. ll_folderrec_star() {
  1420. $CMD_PERL ./imapsync \
  1421. --host1 $HOST1 --user1 tata \
  1422. --passfile1 ../../var/pass/secret.tata \
  1423. --host2 $HOST2 --user2 titi \
  1424. --passfile2 ../../var/pass/secret.titi \
  1425. --folderrec 'INBOX.yop.*' --justfolders
  1426. }
  1427. ll_change_blank() {
  1428. $CMD_PERL ./imapsync \
  1429. --host1 $HOST1 --user1 tata \
  1430. --passfile1 ../../var/pass/secret.tata \
  1431. --host2 $HOST2 --user2 titi \
  1432. --passfile2 ../../var/pass/secret.titi \
  1433. --justfolders --nofoldersizes --folder "INBOX. blanc_begin" --regextrans2 "s,(\.|^) +,\$1,g"
  1434. }
  1435. ll_folderrec_blank_bug() {
  1436. $CMD_PERL ./imapsync \
  1437. --host1 $HOST1 --user1 tata \
  1438. --passfile1 ../../var/pass/secret.tata \
  1439. --host2 $HOST2 --user2 titi \
  1440. --passfile2 ../../var/pass/secret.titi \
  1441. --folderrec "INBOX.blanc "
  1442. }
  1443. ll_folderrec_blank_bug_2() {
  1444. $CMD_PERL ./imapsync \
  1445. --host1 $HOST1 --user1 tata \
  1446. --passfile1 ../../var/pass/secret.tata \
  1447. --host2 $HOST2 --user2 titi \
  1448. --passfile2 ../../var/pass/secret.titi \
  1449. --folderrec "INBOX.blanc"
  1450. }
  1451. ll_folderrec_blank_bug_3() {
  1452. $CMD_PERL ./imapsync \
  1453. --host1 $HOST1 --user1 tata \
  1454. --passfile1 ../../var/pass/secret.tata \
  1455. --host2 $HOST2 --user2 titi \
  1456. --passfile2 ../../var/pass/secret.titi \
  1457. --folderrec '"INBOX.blanc "'
  1458. }
  1459. ll_buffersize() {
  1460. $CMD_PERL ./imapsync \
  1461. --host1 $HOST1 --user1 tata \
  1462. --passfile1 ../../var/pass/secret.tata \
  1463. --host2 $HOST2 --user2 titi \
  1464. --passfile2 ../../var/pass/secret.titi \
  1465. --buffersize 8
  1466. }
  1467. ll_automap() {
  1468. $CMD_PERL ./imapsync \
  1469. --host1 $HOST1 --user1 tata \
  1470. --passfile1 ../../var/pass/secret.tata \
  1471. --host2 $HOST2 --user2 titi \
  1472. --passfile2 ../../var/pass/secret.titi \
  1473. --justautomap --automap
  1474. }
  1475. ll_justautomap() {
  1476. $CMD_PERL ./imapsync \
  1477. --host1 $HOST1 --user1 tata \
  1478. --passfile1 ../../var/pass/secret.tata \
  1479. --host2 $HOST2 --user2 titi \
  1480. --passfile2 ../../var/pass/secret.titi \
  1481. --justautomap
  1482. }
  1483. l_ks_automap() {
  1484. $CMD_PERL ./imapsync \
  1485. --host1 $HOST1 --user1 tata \
  1486. --passfile1 ../../var/pass/secret.tata \
  1487. --host2 test2.lamiral.info --user2 test2 \
  1488. --password2 secret2 \
  1489. --justautomap --automap
  1490. }
  1491. l_gmail_automap() {
  1492. $CMD_PERL ./imapsync \
  1493. --host1 $HOST1 --user1 tata \
  1494. --passfile1 ../../var/pass/secret.tata \
  1495. --host2 imap.gmail.com \
  1496. --ssl2 \
  1497. --user2 imapsync.gl@gmail.com \
  1498. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  1499. --justautomap --automap --dry
  1500. }
  1501. gmail_l_automap() {
  1502. $CMD_PERL ./imapsync \
  1503. --host1 imap.gmail.com \
  1504. --ssl1 \
  1505. --user1 gilles.lamiral@gmail.com \
  1506. --passfile1 ../../var/pass/secret.gilles_gmail \
  1507. --host2 $HOST2 --user2 titi \
  1508. --passfile2 ../../var/pass/secret.titi \
  1509. --justautomap --automap --dry
  1510. }
  1511. ll_justfolders() {
  1512. $CMD_PERL ./imapsync \
  1513. --host1 $HOST1 --user1 tata \
  1514. --passfile1 ../../var/pass/secret.tata \
  1515. --host2 $HOST2 --user2 titi \
  1516. --passfile2 ../../var/pass/secret.titi \
  1517. --justfolders
  1518. echo "sudo rm -rf /home/vmail/titi/.new_folder/"
  1519. }
  1520. ll_create_folder_New1()
  1521. {
  1522. ./W/learn/create_folder localhost tata `cat ../../var/pass/secret.tata` INBOX.New1 INBOX.New1.New1 INBOX.New1.New1.New1
  1523. $CMD_PERL ./imapsync \
  1524. --host1 $HOST1 --user1 tata \
  1525. --passfile1 ../../var/pass/secret.tata \
  1526. --host2 $HOST2 --user2 titi \
  1527. --passfile2 ../../var/pass/secret.titi \
  1528. --justfolders --include New1 --folderfirst INBOX.New1.New1
  1529. }
  1530. ll_delete_folder_New1()
  1531. {
  1532. $CMD_PERL ./imapsync \
  1533. --host1 $HOST1 --user1 tata \
  1534. --passfile1 ../../var/pass/secret.tata \
  1535. --host2 $HOST2 --user2 titi \
  1536. --passfile2 ../../var/pass/secret.titi \
  1537. --include New1 --folderfirst INBOX.New1.New1 --delete1emptyfolders --delete1
  1538. }
  1539. ll_create_folder_encoding_accent()
  1540. {
  1541. ./W/learn/create_folder localhost tata `cat ../../var/pass/secret.tata` INBOX.New1 'INBOX.New1.E&AwE-le&AwE-ments envoye&AwE-s' 'INBOX.New1.&AMk-l&AOk-ments envoy&AOk-s'
  1542. $CMD_PERL ./imapsync \
  1543. --host1 $HOST1 --user1 tata \
  1544. --passfile1 ../../var/pass/secret.tata \
  1545. --host2 $HOST2 --user2 titi \
  1546. --passfile2 ../../var/pass/secret.titi \
  1547. --justfolders --include New1
  1548. }
  1549. ll_create_folder_encoding_accent_365()
  1550. {
  1551. #./W/learn/create_folder localhost tata `cat ../../var/pass/secret.tata` 'INBOX.E&AwE-le&AwE-ments envoye&AwE-s' 'INBOX.&AMk-l&AOk-ments envoy&AOk-s'
  1552. $CMD_PERL ./imapsync \
  1553. --host1 $HOST1 --user1 tata \
  1554. --passfile1 ../../var/pass/secret.tata \
  1555. --host2 imap-mail.outlook.com --user2 gilles.lamiral@outlook.com \
  1556. --passfile2 ../../var/pass/secret.outlook.com \
  1557. --justfolders --include 'ments envoy' --automap --exclude New1
  1558. }
  1559. ll_justfolders_delete1emptyfolders() {
  1560. ./W/learn/create_folder localhost tata `cat ../../var/pass/secret.tata` INBOX.Empty INBOX.Empty.Empty INBOX.Empty.Empty.Empty
  1561. $CMD_PERL ./imapsync \
  1562. --host1 $HOST1 --user1 tata \
  1563. --passfile1 ../../var/pass/secret.tata \
  1564. --host2 $HOST2 --user2 titi \
  1565. --passfile2 ../../var/pass/secret.titi \
  1566. --justfolders --delete1emptyfolders --include Empty --folder INBOX --folderfirst INBOX.Empty.Empty --foldersizes
  1567. }
  1568. ll_delete1_delete1emptyfolders() {
  1569. ./W/learn/create_folder localhost tata `cat ../../var/pass/secret.tata` INBOX.Empty INBOX.Empty.Empty INBOX.Empty.Empty.Empty
  1570. $CMD_PERL ./imapsync \
  1571. --host1 $HOST1 --user1 tata \
  1572. --passfile1 ../../var/pass/secret.tata \
  1573. --host2 $HOST2 --user2 titi \
  1574. --passfile2 ../../var/pass/secret.titi \
  1575. --delete1emptyfolders --delete1 --include Empty --folder INBOX --folderfirst INBOX.Empty.Empty --dry
  1576. }
  1577. ll_justfolders_skipemptyfolders() {
  1578. $CMD_PERL ./imapsync \
  1579. --host1 $HOST1 --user1 tata \
  1580. --passfile1 ../../var/pass/secret.tata \
  1581. --host2 $HOST2 --user2 titi \
  1582. --passfile2 ../../var/pass/secret.titi \
  1583. --justfolders --skipemptyfolders \
  1584. --folder INBOX.empty --folder INBOX.notempty
  1585. }
  1586. ll_justfolders_folderfirst_noexist() {
  1587. $CMD_PERL ./imapsync \
  1588. --host1 $HOST1 --user1 tata \
  1589. --passfile1 ../../var/pass/secret.tata \
  1590. --host2 $HOST2 --user2 titi \
  1591. --passfile2 ../../var/pass/secret.titi \
  1592. --nofoldersizes --justfolders --folderfirst noexist --debug
  1593. }
  1594. ll_justfolders_foldersizes()
  1595. {
  1596. $CMD_PERL ./imapsync \
  1597. --host1 $HOST1 --user1 tata \
  1598. --passfile1 ../../var/pass/secret.tata \
  1599. --host2 $HOST2 --user2 titi \
  1600. --passfile2 ../../var/pass/secret.titi \
  1601. --justfolders
  1602. echo "sudo rm -rf /home/vmail/titi/.new_folder/"
  1603. }
  1604. # In mandatory_tests
  1605. ll_delete2foldersonly_dry()
  1606. {
  1607. $CMD_PERL ./imapsync \
  1608. --host1 $HOST1 --user1 tata \
  1609. --passfile1 ../../var/pass/secret.tata \
  1610. --host2 $HOST2 --user2 titi \
  1611. --passfile2 ../../var/pass/secret.titi \
  1612. --justfolders --nofoldersizes \
  1613. --subfolder2 NEW --delete2foldersonly NEW --dry
  1614. }
  1615. # In mandatory_tests
  1616. ll_delete2foldersonly_subfolder2()
  1617. {
  1618. ./W/learn/create_folder localhost titi `cat /g/var/pass/secret.titi` INBOX.NEW_2
  1619. $CMD_PERL ./imapsync \
  1620. --host1 $HOST1 --user1 tata \
  1621. --passfile1 ../../var/pass/secret.tata \
  1622. --host2 $HOST2 --user2 titi \
  1623. --passfile2 ../../var/pass/secret.titi \
  1624. --justfolders --nofoldersizes \
  1625. --subfolder2 NEW_2 \
  1626. --delete2foldersonly NEW_2 --folder INBOX --debug
  1627. # NEW_2 should be still there because of --subfolder2 NEW_2
  1628. test -d /home/vmail/titi/.NEW_2/ || return 1
  1629. }
  1630. # In mandatory_tests
  1631. ll_delete2foldersbutnot()
  1632. {
  1633. $CMD_PERL ./imapsync \
  1634. --host1 $HOST1 --user1 tata \
  1635. --passfile1 ../../var/pass/secret.tata \
  1636. --host2 $HOST2 --user2 titi \
  1637. --passfile2 ../../var/pass/secret.titi \
  1638. --justfolders --nofoldersizes \
  1639. --delete2foldersbutnot 'm{NEW_2|NEW_3|\[abc\]}' \
  1640. --dry
  1641. }
  1642. # In mandatory_tests
  1643. ll_delete2foldersonly_NEW_3()
  1644. {
  1645. $CMD_PERL ./imapsync \
  1646. --host1 $HOST1 --user1 tata \
  1647. --passfile1 ../../var/pass/secret.tata \
  1648. --host2 $HOST2 --user2 titi \
  1649. --passfile2 ../../var/pass/secret.titi \
  1650. --justfolders --nofoldersizes \
  1651. --regextrans2 's,^INBOX.oneemail$,INBOX.NEW_3.oneemail,' \
  1652. --regextrans2 's,^INBOX.oneemail2$,INBOX.NEW_3.oneemail2,'
  1653. test -d /home/vmail/titi/.NEW_3.oneemail/ || return 1
  1654. test -d /home/vmail/titi/.NEW_3.oneemail2/ || return 1
  1655. $CMD_PERL ./imapsync \
  1656. --host1 $HOST1 --user1 tata \
  1657. --passfile1 ../../var/pass/secret.tata \
  1658. --host2 $HOST2 --user2 titi \
  1659. --passfile2 ../../var/pass/secret.titi \
  1660. --justfolders --nofoldersizes \
  1661. --include 'rrrrr' \
  1662. --delete2foldersonly '/^INBOX.NEW_3.oneemail$/'
  1663. ! test -d /home/vmail/titi/.NEW_3.oneemail/ || return 1
  1664. test -d /home/vmail/titi/.NEW_3.oneemail2/ || return 1
  1665. }
  1666. ll_delete2foldersonly_bug() {
  1667. $CMD_PERL ./imapsync \
  1668. --host1 $HOST1 --user1 tata \
  1669. --passfile1 ../../var/pass/secret.tata \
  1670. --host2 $HOST2 --user2 titi \
  1671. --passfile2 ../../var/pass/secret.titi \
  1672. --justfolders --nofoldersizes \
  1673. --include 'rrrrr' \
  1674. --delete2foldersonly '/INBOX.Archive/' --dry
  1675. # --delete2foldersonly '/^INBOX.Archive$/' --dry
  1676. }
  1677. # In mandatory_tests
  1678. ll_delete2folders()
  1679. {
  1680. $CMD_PERL ./imapsync \
  1681. --host1 $HOST1 --user1 tata \
  1682. --passfile1 ../../var/pass/secret.tata \
  1683. --host2 $HOST2 --user2 titi \
  1684. --passfile2 ../../var/pass/secret.titi \
  1685. --justfolders --nofoldersizes \
  1686. --delete2folders
  1687. ! test -d /home/vmail/titi/.NEW_3/ || return 1
  1688. }
  1689. ll_bug_folder_name_with_blank() {
  1690. $CMD_PERL ./imapsync \
  1691. --host1 $HOST1 --user1 tata \
  1692. --passfile1 ../../var/pass/secret.tata \
  1693. --host2 $HOST2 --user2 titi \
  1694. --passfile2 ../../var/pass/secret.titi \
  1695. --justfolders --fast
  1696. echo "rm -rf /home/vmail/titi/.bugs/"
  1697. }
  1698. ll_bug_folder_name_with_backslash() {
  1699. # Bug with Mail-IMAPClient-2.2.9
  1700. # Fixed using Mail-IMAPClient-3.28
  1701. $CMD_PERL ./imapsync \
  1702. --host1 $HOST1 --user1 tata \
  1703. --passfile1 ../../var/pass/secret.tata \
  1704. --host2 $HOST2 --user2 titi \
  1705. --passfile2 ../../var/pass/secret.titi \
  1706. --fast
  1707. # --folder "INBOX.yop.jj\\kk"
  1708. # --folder '"INBOX.yop.jj\kk"' --debug --debugimap --regextrans2 's,\\,_,g'
  1709. # --folder "INBOX.yop.jj\\kk" --debug --debugimap1
  1710. echo "sudo rm -rf '/home/vmail/titi/.yop.jj\\kk'"
  1711. }
  1712. ll_prefix12() {
  1713. $CMD_PERL ./imapsync \
  1714. --host1 $HOST1 --user1 tata \
  1715. --passfile1 ../../var/pass/secret.tata \
  1716. --host2 $HOST2 --user2 titi \
  1717. --passfile2 ../../var/pass/secret.titi \
  1718. --folder INBOX.qqq \
  1719. --prefix1 INBOX.\
  1720. --prefix2 INBOX.
  1721. }
  1722. ll_nosyncinternaldates() {
  1723. can_send && sendtestmessage toto
  1724. $CMD_PERL ./imapsync \
  1725. --host1 $HOST1 --user1 toto \
  1726. --passfile1 ../../var/pass/secret.toto \
  1727. --host2 $HOST2 --user2 titi \
  1728. --passfile2 ../../var/pass/secret.titi \
  1729. --folder INBOX \
  1730. --nosyncinternaldates --delete2
  1731. }
  1732. # bug:
  1733. # $d=""; # no bug with $d=undef
  1734. # $imap2->append_string($h2_fold,$string, $h1_flags, $d);
  1735. # 3.25 idate : Sending: 16 APPEND INBOX () "16-Jul-2010 22:09:42 +0200" {428}
  1736. # 2.xx idate : Sending: 62 APPEND INBOX "16-Jul-2010 22:14:00 +0200" {428}
  1737. # 3.25 noidate: Sending: 16 APPEND INBOX () "" {428} # Fails: NO IMAP!
  1738. # 2.xx noidate: Sending: 62 APPEND INBOX {428}
  1739. ll_idatefromheader() {
  1740. # can_send && sendtestmessage
  1741. $CMD_PERL ./imapsync \
  1742. --host1 $HOST1 --user1 tata \
  1743. --passfile1 ../../var/pass/secret.tata \
  1744. --host2 $HOST2 --user2 titi \
  1745. --passfile2 ../../var/pass/secret.titi \
  1746. --folder INBOX.oneemail2 \
  1747. --idatefromheader --debug --dry
  1748. }
  1749. ll_idatefromheader_barker() {
  1750. # can_send && sendtestmessage
  1751. $CMD_PERL ./imapsync \
  1752. --host1 $HOST1 --user1 tata \
  1753. --passfile1 ../../var/pass/secret.tata \
  1754. --host2 imap.europe.secureserver.net --user2 test@alicebarkertest.com \
  1755. --passfile2 ../../var/pass/secret.barker \
  1756. --folder INBOX.oneemail2 --nofoldersizes \
  1757. --debug --useheader ALL
  1758. }
  1759. ll_folder_rev() {
  1760. $CMD_PERL ./imapsync \
  1761. --host1 $HOST1 --user1 titi \
  1762. --passfile1 ../../var/pass/secret.titi \
  1763. --host2 $HOST2 --user2 tata \
  1764. --passfile2 ../../var/pass/secret.tata \
  1765. --folder INBOX.yop
  1766. }
  1767. ll_subscribed()
  1768. {
  1769. $CMD_PERL ./imapsync \
  1770. --host1 $HOST1 --user1 tata \
  1771. --passfile1 ../../var/pass/secret.tata \
  1772. --host2 $HOST2 --user2 titi \
  1773. --passfile2 ../../var/pass/secret.titi \
  1774. --subscribed
  1775. }
  1776. ll_nosubscribe()
  1777. {
  1778. $CMD_PERL ./imapsync \
  1779. --host1 $HOST1 --user1 tata \
  1780. --passfile1 ../../var/pass/secret.tata \
  1781. --host2 $HOST2 --user2 titi \
  1782. --passfile2 ../../var/pass/secret.titi \
  1783. --subscribed --nosubscribe
  1784. }
  1785. ll_justconnect()
  1786. {
  1787. $CMD_PERL ./imapsync \
  1788. --host1 $HOST1 \
  1789. --host2 $HOST2 \
  1790. --justconnect --debugimap
  1791. }
  1792. ll_justconnect_ipv6()
  1793. {
  1794. $CMD_PERL ./imapsync \
  1795. --host1 "::1" \
  1796. --host2 "::1" \
  1797. --justconnect
  1798. }
  1799. ll_justconnect_ipv6_nossl()
  1800. {
  1801. $CMD_PERL ./imapsync \
  1802. --host1 "::1" --nossl1 \
  1803. --host2 "::1" --nossl2 \
  1804. --justconnect
  1805. }
  1806. ks_justconnect_ipv6()
  1807. {
  1808. $CMD_PERL ./imapsync \
  1809. --host1 ks2ipv6.lamiral.info \
  1810. --host2 ks2ipv6.lamiral.info \
  1811. --justconnect
  1812. }
  1813. ks_justconnect_ipv6_nossl()
  1814. {
  1815. $CMD_PERL ./imapsync \
  1816. --host1 ks2ipv6.lamiral.info --nossl1 \
  1817. --host2 ks2ipv6.lamiral.info --nossl2 \
  1818. --justconnect
  1819. }
  1820. ll_justfoldersizes()
  1821. {
  1822. $CMD_PERL ./imapsync \
  1823. --host1 $HOST1 --user1 tata \
  1824. --passfile1 ../../var/pass/secret.tata \
  1825. --host2 $HOST2 --user2 titi \
  1826. --nocheckfoldersexist --nocheckselectable \
  1827. --passfile2 ../../var/pass/secret.titi \
  1828. --justfoldersizes # --folder INBOX
  1829. }
  1830. ll_justfoldersizes_all_to_INBOX()
  1831. {
  1832. $CMD_PERL ./imapsync \
  1833. --host1 $HOST1 --user1 tata \
  1834. --passfile1 ../../var/pass/secret.tata \
  1835. --host2 $HOST2 --user2 titi \
  1836. --nocheckfoldersexist --nocheckselectable \
  1837. --passfile2 ../../var/pass/secret.titi \
  1838. --justfoldersizes --regextrans2 's/.*/INBOX/'
  1839. }
  1840. ll_justfoldersizes_case_different()
  1841. {
  1842. $CMD_PERL ./imapsync \
  1843. --host1 $HOST1 --user1 tata \
  1844. --passfile1 ../../var/pass/secret.tata \
  1845. --host2 $HOST2 --user2 titi \
  1846. --passfile2 ../../var/pass/secret.titi \
  1847. --nocheckfoldersexist --nocheckselectable \
  1848. --justfoldersizes --folder NoExist --folder INBOX --regextrans2 's,^INBOX$,iNbOx,'
  1849. }
  1850. ll_justfoldersizes_case_different_2()
  1851. {
  1852. $CMD_PERL ./imapsync \
  1853. --host1 $HOST1 --user1 tata \
  1854. --passfile1 ../../var/pass/secret.tata \
  1855. --host2 $HOST2 --user2 titi \
  1856. --passfile2 ../../var/pass/secret.titi \
  1857. --justfoldersizes --folder INBOX.yop --regextrans2 's,yop,YoP,'
  1858. }
  1859. ll_justfoldersizes_noexist()
  1860. {
  1861. $CMD_PERL ./imapsync \
  1862. --host1 $HOST1 --user1 tata \
  1863. --passfile1 ../../var/pass/secret.tata \
  1864. --host2 $HOST2 --user2 titi \
  1865. --passfile2 ../../var/pass/secret.titi \
  1866. --justfoldersizes --folder NoExist --folder AnotherNoExist \
  1867. --nocheckfoldersexist --errorsmax 2
  1868. }
  1869. ll_reconnect_on_signal_debugimap()
  1870. {
  1871. # in another terminal:
  1872. #
  1873. : <<'EOF'
  1874. while echo ENTER TO STOP; read a ; do
  1875. killall --signal STOP -v -u vmail imapd
  1876. echo ENTER to CONT; read a
  1877. killall --signal CONT -v -u vmail imapd
  1878. done
  1879. EOF
  1880. $CMD_PERL ./imapsync \
  1881. --host1 $HOST1 --user1 tata \
  1882. --passfile1 ../../var/pass/secret.tata \
  1883. --host2 $HOST2 --user2 titi \
  1884. --passfile2 ../../var/pass/secret.titi \
  1885. --debugsleep 3.5 --debugimap
  1886. }
  1887. ll_reconnect_on_signal()
  1888. {
  1889. $CMD_PERL ./imapsync \
  1890. --host1 $HOST1 --user1 tata \
  1891. --passfile1 ../../var/pass/secret.tata \
  1892. --host2 $HOST2 --user2 titi \
  1893. --passfile2 ../../var/pass/secret.titi
  1894. }
  1895. ll_dev_reconnect_none()
  1896. {
  1897. # in another terminal:
  1898. #
  1899. : <<'EOF'
  1900. while :; do
  1901. killall -v -u vmail imapd;
  1902. RAND_WAIT=`numrandom .1..5i.1`
  1903. echo sleeping $RAND_WAIT
  1904. sleepenh $RAND_WAIT
  1905. done
  1906. # or
  1907. while read y; do
  1908. killall -v -u vmail imapd
  1909. done
  1910. EOF
  1911. $CMD_PERL ./imapsync \
  1912. --host1 $HOST1 --user1 tata \
  1913. --passfile1 ../../var/pass/secret.tata \
  1914. --host2 $HOST2 --user2 titi \
  1915. --passfile2 ../../var/pass/secret.titi \
  1916. --folder INBOX --useuid \
  1917. --reconnectretry2 0 --reconnectretry1 0
  1918. }
  1919. ll_dev_reconnect_one()
  1920. {
  1921. # in another root terminal:
  1922. #
  1923. : <<'EOF'
  1924. while read y; do
  1925. killall -v -u vmail imapd
  1926. done
  1927. EOF
  1928. $CMD_PERL ./imapsync \
  1929. --host1 $HOST1 --user1 tata \
  1930. --passfile1 ../../var/pass/secret.tata \
  1931. --host2 $HOST2 --user2 titi \
  1932. --passfile2 ../../var/pass/secret.titi \
  1933. --folder INBOX --useuid \
  1934. --reconnectretry2 1 --reconnectretry1 1
  1935. }
  1936. ll_dev_reconnect_ssl_tls()
  1937. {
  1938. # in another terminal:
  1939. #
  1940. : <<'EOF'
  1941. while :; do
  1942. killall -v -u vmail imapd;
  1943. RAND_WAIT=`numrandom .1..5i.1`
  1944. echo sleeping $RAND_WAIT
  1945. sleepenh $RAND_WAIT
  1946. done
  1947. # or
  1948. while read y; do
  1949. echo ENTER to kill all imapd
  1950. killall -v -u vmail imapd;
  1951. done
  1952. EOF
  1953. can_send && sendtestmessage
  1954. # can_send && sendtestmessage
  1955. $CMD_PERL ./imapsync \
  1956. --host1 $HOST1 --ssl1 --user1 tata \
  1957. --passfile1 ../../var/pass/secret.tata \
  1958. --host2 $HOST2 --tls2 --user2 titi \
  1959. --passfile2 ../../var/pass/secret.titi \
  1960. --folder INBOX --useuid \
  1961. --delete2
  1962. }
  1963. ll_dev_reconnect_tls()
  1964. {
  1965. # in another terminal:
  1966. #
  1967. : <<'EOF'
  1968. while :; do
  1969. killall -v -u vmail imapd;
  1970. RAND_WAIT=`numrandom .1..5i.1`
  1971. echo sleeping $RAND_WAIT
  1972. sleepenh $RAND_WAIT
  1973. done
  1974. # or
  1975. while read y; do
  1976. echo ENTER to kill all imapd
  1977. killall -v -u vmail imapd;
  1978. done
  1979. EOF
  1980. can_send && sendtestmessage
  1981. # can_send && sendtestmessage
  1982. $CMD_PERL ./imapsync \
  1983. --host1 $HOST1 --tls1 --user1 tata \
  1984. --passfile1 ../../var/pass/secret.tata \
  1985. --host2 $HOST2 --tls2 --user2 titi \
  1986. --passfile2 ../../var/pass/secret.titi \
  1987. --folder INBOX --useuid \
  1988. --delete2 --debugsleep 5 --debugimap
  1989. }
  1990. ll_authmd5()
  1991. {
  1992. $CMD_PERL ./imapsync \
  1993. --host1 $HOST1 --user1 tata \
  1994. --passfile1 ../../var/pass/secret.tata \
  1995. --host2 $HOST2 --user2 titi \
  1996. --passfile2 ../../var/pass/secret.titi \
  1997. --justlogin --authmd5
  1998. }
  1999. ll_authmd51()
  2000. {
  2001. $CMD_PERL ./imapsync \
  2002. --host1 $HOST1 --user1 tata \
  2003. --passfile1 ../../var/pass/secret.tata \
  2004. --host2 $HOST2 --user2 titi \
  2005. --passfile2 ../../var/pass/secret.titi \
  2006. --justlogin --authmd51
  2007. }
  2008. ll_authmd52()
  2009. {
  2010. $CMD_PERL ./imapsync \
  2011. --host1 $HOST1 --user1 tata \
  2012. --passfile1 ../../var/pass/secret.tata \
  2013. --host2 $HOST2 --user2 titi \
  2014. --passfile2 ../../var/pass/secret.titi \
  2015. --justlogin --authmd52
  2016. }
  2017. ll_noauthmd5()
  2018. {
  2019. $CMD_PERL ./imapsync \
  2020. --host1 $HOST1 --user1 tata \
  2021. --passfile1 ../../var/pass/secret.tata \
  2022. --host2 $HOST2 --user2 titi \
  2023. --passfile2 ../../var/pass/secret.titi \
  2024. --justlogin --noauthmd5
  2025. }
  2026. ll_maxage()
  2027. {
  2028. can_send && sendtestmessage
  2029. $CMD_PERL ./imapsync \
  2030. --host1 $HOST1 --user1 tata \
  2031. --passfile1 ../../var/pass/secret.tata \
  2032. --host2 $HOST2 --user2 titi \
  2033. --passfile2 ../../var/pass/secret.titi \
  2034. --maxage 1 --folder INBOX
  2035. }
  2036. ll_maxage_0()
  2037. {
  2038. can_send && sendtestmessage
  2039. $CMD_PERL ./imapsync \
  2040. --host1 $HOST1 --user1 tata \
  2041. --passfile1 ../../var/pass/secret.tata \
  2042. --host2 $HOST2 --user2 titi \
  2043. --passfile2 ../../var/pass/secret.titi \
  2044. --maxage 0 --folder INBOX
  2045. }
  2046. ll_maxage_0_float_1min()
  2047. {
  2048. can_send && sendtestmessage
  2049. $CMD_PERL ./imapsync \
  2050. --host1 $HOST1 --user1 tata \
  2051. --passfile1 ../../var/pass/secret.tata \
  2052. --host2 $HOST2 --user2 titi \
  2053. --passfile2 ../../var/pass/secret.titi \
  2054. --maxage 0.0006944 --folder INBOX --noabletosearch
  2055. }
  2056. ll_minage_0()
  2057. {
  2058. can_send && sendtestmessage
  2059. $CMD_PERL ./imapsync \
  2060. --host1 $HOST1 --user1 tata \
  2061. --passfile1 ../../var/pass/secret.tata \
  2062. --host2 $HOST2 --user2 titi \
  2063. --passfile2 ../../var/pass/secret.titi \
  2064. --minage 0 --folder INBOX
  2065. }
  2066. ll_maxage_10000_minage_9999()
  2067. {
  2068. # INTERSECTION: 0 messages
  2069. $CMD_PERL ./imapsync \
  2070. --host1 $HOST1 --user1 tata \
  2071. --passfile1 ../../var/pass/secret.tata \
  2072. --host2 $HOST2 --user2 titi \
  2073. --passfile2 ../../var/pass/secret.titi \
  2074. --maxage 10000 --minage 9999 \
  2075. --folder INBOX --justfoldersizes
  2076. }
  2077. ll_maxage_9999_minage_10000()
  2078. {
  2079. # UNION: all messages
  2080. $CMD_PERL ./imapsync \
  2081. --host1 $HOST1 --user1 tata \
  2082. --passfile1 ../../var/pass/secret.tata \
  2083. --host2 $HOST2 --user2 titi \
  2084. --passfile2 ../../var/pass/secret.titi \
  2085. --maxage 9999 --minage 10000 \
  2086. --folder INBOX --justfoldersizes
  2087. }
  2088. ll_maxage_10000_minage_9999_noabletosearch()
  2089. {
  2090. # INTERSECTION: 0 messages
  2091. $CMD_PERL ./imapsync \
  2092. --host1 $HOST1 --user1 tata \
  2093. --passfile1 ../../var/pass/secret.tata \
  2094. --host2 $HOST2 --user2 titi \
  2095. --passfile2 ../../var/pass/secret.titi \
  2096. --maxage 10000 --minage 9999 \
  2097. --folder INBOX --justfoldersizes --noabletosearch
  2098. }
  2099. ll_maxage_9999_minage_10000_noabletosearch()
  2100. {
  2101. # UNION: all messages
  2102. $CMD_PERL ./imapsync \
  2103. --host1 $HOST1 --user1 tata \
  2104. --passfile1 ../../var/pass/secret.tata \
  2105. --host2 $HOST2 --user2 titi \
  2106. --passfile2 ../../var/pass/secret.titi \
  2107. --maxage 9999 --minage 10000 \
  2108. --folder INBOX --justfoldersizes --noabletosearch
  2109. }
  2110. ll_maxage_10000()
  2111. {
  2112. can_send && sendtestmessage
  2113. $CMD_PERL ./imapsync \
  2114. --host1 $HOST1 --user1 tata \
  2115. --passfile1 ../../var/pass/secret.tata \
  2116. --host2 $HOST2 --user2 titi \
  2117. --passfile2 ../../var/pass/secret.titi \
  2118. --maxage 10000 --folder INBOX
  2119. }
  2120. ll_maxage_0_debugimap2()
  2121. {
  2122. #can_send && sendtestmessage
  2123. $CMD_PERL ./imapsync \
  2124. --host1 $HOST1 --user1 tata \
  2125. --passfile1 ../../var/pass/secret.tata \
  2126. --host2 $HOST2 --user2 titi \
  2127. --passfile2 ../../var/pass/secret.titi \
  2128. --maxage 0 --folder INBOX --debugimap2 --nofoldersizes
  2129. }
  2130. ll_search_ALL()
  2131. {
  2132. $CMD_PERL ./imapsync \
  2133. --host1 $HOST1 --user1 tata \
  2134. --passfile1 ../../var/pass/secret.tata \
  2135. --host2 $HOST2 --user2 titi \
  2136. --passfile2 ../../var/pass/secret.titi \
  2137. --search 'ALL' --folder INBOX
  2138. }
  2139. ll_search1_NOT_OR_OR_UID()
  2140. {
  2141. $CMD_PERL ./imapsync \
  2142. --host1 $HOST1 --user1 tata \
  2143. --passfile1 ../../var/pass/secret.tata \
  2144. --host2 $HOST2 --user2 titi \
  2145. --passfile2 ../../var/pass/secret.titi \
  2146. --search1 'NOT OR OR UID 20000 UID 20002 UID 20004' --folder INBOX
  2147. }
  2148. ll_search1_OR_OR_UID()
  2149. {
  2150. $CMD_PERL ./imapsync \
  2151. --host1 $HOST1 --user1 tata \
  2152. --passfile1 ../../var/pass/secret.tata \
  2153. --host2 $HOST2 --user2 titi \
  2154. --passfile2 ../../var/pass/secret.titi \
  2155. --search1 'OR OR UID 20000 UID 20002 UID 20004' --folder INBOX
  2156. }
  2157. ll_search2_NOT_OR_OR_UID()
  2158. {
  2159. $CMD_PERL ./imapsync \
  2160. --host1 $HOST1 --user1 tata \
  2161. --passfile1 ../../var/pass/secret.tata \
  2162. --host2 $HOST2 --user2 titi \
  2163. --passfile2 ../../var/pass/secret.titi \
  2164. --search2 'NOT OR OR UID 20000 UID 20002 UID 20004' --folder INBOX
  2165. }
  2166. ll_search_FLAGGED()
  2167. {
  2168. can_send && sendtestmessage
  2169. $CMD_PERL ./imapsync \
  2170. --host1 $HOST1 --user1 tata \
  2171. --passfile1 ../../var/pass/secret.tata \
  2172. --host2 $HOST2 --user2 titi \
  2173. --passfile2 ../../var/pass/secret.titi \
  2174. --search 'FLAGGED' --folder INBOX
  2175. }
  2176. ll_search_NOT_DELETED()
  2177. {
  2178. can_send && sendtestmessage
  2179. $CMD_PERL ./imapsync \
  2180. --host1 $HOST1 --user1 tata \
  2181. --passfile1 ../../var/pass/secret.tata \
  2182. --host2 $HOST2 --user2 titi \
  2183. --passfile2 ../../var/pass/secret.titi \
  2184. --search 'NOT DELETED' --folder INBOX
  2185. }
  2186. ll_search_SENTSINCE()
  2187. {
  2188. can_send && sendtestmessage
  2189. $CMD_PERL ./imapsync \
  2190. --host1 $HOST1 --user1 tata \
  2191. --passfile1 ../../var/pass/secret.tata \
  2192. --host2 $HOST2 --user2 titi \
  2193. --passfile2 ../../var/pass/secret.titi \
  2194. --search 'SENTSINCE 11-Jul-2011' --folder INBOX
  2195. }
  2196. ll_search_BEFORE_delete2_useuid()
  2197. {
  2198. can_send && sendtestmessage titi
  2199. $CMD_PERL ./imapsync \
  2200. --host1 $HOST1 --user1 tata \
  2201. --passfile1 ../../var/pass/secret.tata \
  2202. --host2 $HOST2 --user2 titi \
  2203. --passfile2 ../../var/pass/secret.titi \
  2204. --search 'BEFORE 29-Sep-2011' --folder INBOX --delete2 --useuid
  2205. }
  2206. ll_search_SENTBEFORE()
  2207. {
  2208. can_send && sendtestmessage titi
  2209. $CMD_PERL ./imapsync \
  2210. --host1 $HOST1 --user1 tata \
  2211. --passfile1 ../../var/pass/secret.tata \
  2212. --host2 $HOST2 --user2 titi \
  2213. --passfile2 ../../var/pass/secret.titi \
  2214. --search 'SENTBEFORE 31-Dec-2013' --folder INBOX --delete2
  2215. }
  2216. ll_search_SENTSINCE_and_BEFORE()
  2217. {
  2218. $CMD_PERL ./imapsync \
  2219. --host1 $HOST1 --user1 tata \
  2220. --passfile1 ../../var/pass/secret.tata \
  2221. --host2 $HOST2 --user2 titi \
  2222. --passfile2 ../../var/pass/secret.titi \
  2223. --search 'SENTSINCE 1-Jan-2010 SENTBEFORE 31-Dec-2013' --folder INBOX --delete2 --dry
  2224. }
  2225. ll_search_SENTSINCE_and_BEFORE_search2()
  2226. {
  2227. $CMD_PERL ./imapsync \
  2228. --host1 $HOST1 --user1 tata \
  2229. --passfile1 ../../var/pass/secret.tata \
  2230. --host2 $HOST2 --user2 titi \
  2231. --passfile2 ../../var/pass/secret.titi \
  2232. --search 'SENTSINCE 1-Jan-2010 SENTBEFORE 31-Dec-2013' \
  2233. --search2 'ALL' --folder INBOX --delete2
  2234. }
  2235. ll_search_HEADER_attachment()
  2236. {
  2237. $CMD_PERL ./imapsync \
  2238. --host1 $HOST1 --user1 tata \
  2239. --passfile1 ../../var/pass/secret.tata \
  2240. --host2 $HOST2 --user2 titi \
  2241. --passfile2 ../../var/pass/secret.titi \
  2242. --search "OR HEADER Content-Disposition attachment HEADER Content-Type multipart/mixed" \
  2243. --folder INBOX
  2244. }
  2245. ll_search_NOT_HEADER_attachment()
  2246. {
  2247. $CMD_PERL ./imapsync \
  2248. --host1 $HOST1 --user1 tata \
  2249. --passfile1 ../../var/pass/secret.tata \
  2250. --host2 $HOST2 --user2 titi \
  2251. --passfile2 ../../var/pass/secret.titi \
  2252. --search "NOT OR HEADER Content-Disposition attachment HEADER Content-Type multipart/mixed" \
  2253. --folder INBOX
  2254. }
  2255. ll_search_HEADER_attachment_multipart()
  2256. {
  2257. $CMD_PERL ./imapsync \
  2258. --host1 $HOST1 --user1 tata \
  2259. --passfile1 ../../var/pass/secret.tata \
  2260. --host2 $HOST2 --user2 titi \
  2261. --passfile2 ../../var/pass/secret.titi \
  2262. --search "HEADER Content-Type multipart/mixed" \
  2263. --folder INBOX
  2264. }
  2265. ll_search_NOT_SUBJECT()
  2266. {
  2267. $CMD_PERL ./imapsync \
  2268. --host1 $HOST1 --user1 tata \
  2269. --passfile1 ../../var/pass/secret.tata \
  2270. --host2 $HOST2 --user2 titi \
  2271. --passfile2 ../../var/pass/secret.titi \
  2272. --search "NOT SUBJECT test:" \
  2273. --folder INBOX
  2274. }
  2275. ll_search_UNSEEN_SENTSINCE()
  2276. {
  2277. $CMD_PERL ./imapsync \
  2278. --host1 $HOST1 --user1 tata \
  2279. --passfile1 ../../var/pass/secret.tata \
  2280. --host2 $HOST2 --user2 titi \
  2281. --passfile2 ../../var/pass/secret.titi \
  2282. --search "UNSEEN SENTSINCE 23-Aug-2015" \
  2283. --folder INBOX --dry
  2284. }
  2285. ll_search_FROM_TO_CC()
  2286. {
  2287. $CMD_PERL ./imapsync \
  2288. --host1 $HOST1 --user1 tata \
  2289. --passfile1 ../../var/pass/secret.tata \
  2290. --host2 $HOST2 --user2 titi \
  2291. --passfile2 ../../var/pass/secret.titi \
  2292. --folder INBOX --dry --search 'OR FROM gilles@localhost (OR TO gilles@localhost (CC gilles@localhost))'
  2293. }
  2294. ll_search_FROM()
  2295. {
  2296. $CMD_PERL ./imapsync \
  2297. --host1 $HOST1 --user1 tata \
  2298. --passfile1 ../../var/pass/secret.tata \
  2299. --host2 $HOST2 --user2 titi \
  2300. --passfile2 ../../var/pass/secret.titi \
  2301. --folder INBOX --dry --search 'FROM gilles@localhost'
  2302. }
  2303. ll_maxage_nonew()
  2304. {
  2305. can_send && sendtestmessage
  2306. $CMD_PERL ./imapsync \
  2307. --host1 $HOST1 --user1 tata \
  2308. --passfile1 ../../var/pass/secret.tata \
  2309. --host2 $HOST2 --user2 titi \
  2310. --passfile2 ../../var/pass/secret.titi \
  2311. --maxage 1 --nofoldersizes \
  2312. --folder INBOX.few_emails
  2313. }
  2314. ll_noabletosearch()
  2315. {
  2316. $CMD_PERL ./imapsync \
  2317. --host1 $HOST1 --user1 tata \
  2318. --passfile1 ../../var/pass/secret.tata \
  2319. --host2 $HOST2 --user2 titi \
  2320. --passfile2 ../../var/pass/secret.titi \
  2321. --folder INBOX.few_emails --noabletosearch
  2322. # --debugdev --debugimap
  2323. }
  2324. ll_fetch_hash_set()
  2325. {
  2326. $CMD_PERL ./imapsync \
  2327. --host1 $HOST1 --user1 tata \
  2328. --passfile1 ../../var/pass/secret.tata \
  2329. --host2 $HOST2 --user2 titi \
  2330. --passfile2 ../../var/pass/secret.titi \
  2331. --folder INBOX --justfoldersizes --noabletosearch --fetch_hash_set '1:*'
  2332. # --debugdev --debugimap
  2333. }
  2334. ll_fetch_hash_set_abletosearch()
  2335. {
  2336. $CMD_PERL ./imapsync \
  2337. --host1 $HOST1 --user1 tata \
  2338. --passfile1 ../../var/pass/secret.tata \
  2339. --host2 $HOST2 --user2 titi \
  2340. --passfile2 ../../var/pass/secret.titi \
  2341. --folder INBOX --justfoldersizes --abletosearch --fetch_hash_set '1:*'
  2342. # --debugdev --debugimap
  2343. }
  2344. ll_noabletosearch1()
  2345. {
  2346. $CMD_PERL ./imapsync \
  2347. --host1 $HOST1 --user1 tata \
  2348. --passfile1 ../../var/pass/secret.tata \
  2349. --host2 $HOST2 --user2 titi \
  2350. --passfile2 ../../var/pass/secret.titi \
  2351. --folder INBOX.few_emails --noabletosearch1 --debugimap
  2352. }
  2353. ll_noabletosearch2()
  2354. {
  2355. $CMD_PERL ./imapsync \
  2356. --host1 $HOST1 --user1 tata \
  2357. --passfile1 ../../var/pass/secret.tata \
  2358. --host2 $HOST2 --user2 titi \
  2359. --passfile2 ../../var/pass/secret.titi \
  2360. --folder INBOX.few_emails --noabletosearch2 --debugimap
  2361. }
  2362. ll_newmessage()
  2363. {
  2364. can_send && sendtestmessage
  2365. can_send && sendtestmessage
  2366. $CMD_PERL ./imapsync \
  2367. --host1 $HOST1 --user1 tata \
  2368. --passfile1 ../../var/pass/secret.tata \
  2369. --host2 $HOST2 --user2 titi \
  2370. --passfile2 ../../var/pass/secret.titi \
  2371. --maxage 1 --folder INBOX --nofoldersizes \
  2372. --debugLIST
  2373. }
  2374. ll_debugLIST()
  2375. {
  2376. $CMD_PERL ./imapsync \
  2377. --host1 $HOST1 --user1 tata \
  2378. --passfile1 ../../var/pass/secret.tata \
  2379. --host2 $HOST2 --user2 titi \
  2380. --passfile2 ../../var/pass/secret.titi \
  2381. --folder INBOX --nofoldersizes \
  2382. --debugLIST
  2383. }
  2384. ll_search_UID()
  2385. {
  2386. $CMD_PERL ./imapsync \
  2387. --host1 $HOST1 --user1 tata \
  2388. --passfile1 ../../var/pass/secret.tata \
  2389. --host2 $HOST2 --user2 titi \
  2390. --passfile2 ../../var/pass/secret.titi \
  2391. --folder INBOX --nofoldersizes \
  2392. --debugLIST --search1 "UID 10000:20000"
  2393. }
  2394. ll_exitwhenover()
  2395. {
  2396. sendtestmessage
  2397. sendtestmessage
  2398. $CMD_PERL ./imapsync \
  2399. --host1 $HOST1 --user1 tata \
  2400. --passfile1 ../../var/pass/secret.tata \
  2401. --host2 $HOST2 --user2 titi \
  2402. --passfile2 ../../var/pass/secret.titi \
  2403. --maxage 1 --folder INBOX --nofoldersizes \
  2404. --exitwhenover 100
  2405. test "$EXIT_TRANSFER_EXCEEDED" = "$?"
  2406. }
  2407. ll_exitwhenover_noerrorsdump()
  2408. {
  2409. sendtestmessage
  2410. sendtestmessage
  2411. $CMD_PERL ./imapsync \
  2412. --host1 $HOST1 --user1 tata \
  2413. --passfile1 ../../var/pass/secret.tata \
  2414. --host2 $HOST2 --user2 titi \
  2415. --passfile2 ../../var/pass/secret.titi \
  2416. --maxage 1 --folder INBOX --nofoldersizes \
  2417. --exitwhenover 100 --noerrorsdump
  2418. test "$EXIT_TRANSFER_EXCEEDED" = "$?"
  2419. }
  2420. ll_folder_INBOX()
  2421. {
  2422. $CMD_PERL ./imapsync \
  2423. --host1 $HOST1 --user1 tata \
  2424. --passfile1 ../../var/pass/secret.tata \
  2425. --host2 $HOST2 --user2 titi \
  2426. --passfile2 ../../var/pass/secret.titi \
  2427. --folder INBOX --noreleasecheck --usecache --delete2
  2428. }
  2429. ll_dry_folder_missing()
  2430. {
  2431. $CMD_PERL ./imapsync \
  2432. --host1 $HOST1 --user1 tata \
  2433. --passfile1 ../../var/pass/secret.tata \
  2434. --host2 $HOST2 --user2 titi \
  2435. --passfile2 ../../var/pass/secret.titi \
  2436. --folder INBOX --dry --regextrans2 "s,^INBOX$,noexit,"
  2437. }
  2438. ll_maxage_9999()
  2439. {
  2440. # can_send && sendtestmessage
  2441. $CMD_PERL ./imapsync \
  2442. --host1 $HOST1 --user1 tata \
  2443. --passfile1 ../../var/pass/secret.tata \
  2444. --host2 $HOST2 --user2 titi \
  2445. --passfile2 ../../var/pass/secret.titi \
  2446. --justfoldersizes --folder INBOX \
  2447. --maxage 9999
  2448. }
  2449. ll_maxlinelength()
  2450. {
  2451. can_send && sendtestmessage
  2452. $CMD_PERL ./imapsync \
  2453. --host1 $HOST1 --user1 tata \
  2454. --passfile1 ../../var/pass/secret.tata \
  2455. --host2 $HOST2 --user2 titi \
  2456. --passfile2 ../../var/pass/secret.titi \
  2457. --maxlinelength 8 --nofoldersizes --folder INBOX
  2458. }
  2459. ll_maxlinelengthcmd()
  2460. {
  2461. can_send && sendtestmessage
  2462. $CMD_PERL ./imapsync \
  2463. --host1 $HOST1 --user1 tata \
  2464. --passfile1 ../../var/pass/secret.tata \
  2465. --host2 $HOST2 --user2 titi \
  2466. --passfile2 ../../var/pass/secret.titi \
  2467. --maxlinelength 8 --maxlinelengthcmd cat --nofoldersizes --folder INBOX
  2468. }
  2469. ll_minmaxlinelength()
  2470. {
  2471. can_send && sendtestmessage
  2472. $CMD_PERL ./imapsync \
  2473. --host1 $HOST1 --user1 tata \
  2474. --passfile1 ../../var/pass/secret.tata \
  2475. --host2 $HOST2 --user2 titi \
  2476. --passfile2 ../../var/pass/secret.titi \
  2477. --minmaxlinelength 1000 --nofoldersizes --folder INBOX
  2478. }
  2479. ll_maxlinelength_prepa_1()
  2480. {
  2481. $CMD_PERL ./imapsync \
  2482. --host1 $HOST1 --user1 gilles@est.belle \
  2483. --passfile1 ../../var/pass/secret.gilles_mbox \
  2484. --host2 $HOST2 --user2 tete@est.belle \
  2485. --passfile2 ../../var/pass/secret.tete \
  2486. --folderrec INBOX.Junk --foldersizes --justfolders \
  2487. --usecache --tmpdir /var/tmp --minmaxlinelength 8000 --debugmaxlinelength
  2488. }
  2489. ll_maxlinelength_prepa_2()
  2490. {
  2491. $CMD_PERL ./imapsync \
  2492. --host1 $HOST1 --user1 tete@est.belle \
  2493. --passfile1 ../../var/pass/secret.tete \
  2494. --host2 ks.lamiral.info --user2 tata \
  2495. --passfile2 ../../var/pass/secret.tata \
  2496. --ssl2 \
  2497. --include INBOX.Junk.20 --foldersizes --nojustfolders \
  2498. --useuid --tmpdir /var/tmp --minmaxlinelength 10 --delete2 --nofastio1 --nofastio2
  2499. }
  2500. ll_maxsize()
  2501. {
  2502. $CMD_PERL ./imapsync \
  2503. --host1 $HOST1 --user1 tata \
  2504. --passfile1 ../../var/pass/secret.tata \
  2505. --host2 $HOST2 --user2 titi \
  2506. --passfile2 ../../var/pass/secret.titi \
  2507. --maxsize 10 --folder INBOX
  2508. }
  2509. ll_maxsize_useuid()
  2510. {
  2511. $CMD_PERL ./imapsync \
  2512. --host1 $HOST1 --user1 tata \
  2513. --passfile1 ../../var/pass/secret.tata \
  2514. --host2 $HOST2 --user2 titi \
  2515. --passfile2 ../../var/pass/secret.titi \
  2516. --maxsize 10 --folder INBOX \
  2517. --useuid --debugcache
  2518. }
  2519. ll_minsize_useuid()
  2520. {
  2521. can_send && sendtestmessage
  2522. $CMD_PERL ./imapsync \
  2523. --host1 $HOST1 --user1 tata \
  2524. --passfile1 ../../var/pass/secret.tata \
  2525. --host2 $HOST2 --user2 titi \
  2526. --passfile2 ../../var/pass/secret.titi \
  2527. --folder INBOX \
  2528. --useuid --debugLIST --minsize 500 --maxage 1
  2529. }
  2530. ll_skipsize()
  2531. {
  2532. can_send && sendtestmessage
  2533. $CMD_PERL ./imapsync \
  2534. --host1 $HOST1 --user1 tata \
  2535. --passfile1 ../../var/pass/secret.tata \
  2536. --host2 $HOST2 --user2 titi \
  2537. --passfile2 ../../var/pass/secret.titi \
  2538. --skipsize --folder INBOX.yop.yap
  2539. }
  2540. ll_skipheader()
  2541. {
  2542. can_send && sendtestmessage
  2543. $CMD_PERL ./imapsync \
  2544. --host1 $HOST1 --user1 tata \
  2545. --passfile1 ../../var/pass/secret.tata \
  2546. --host2 $HOST2 --user2 titi \
  2547. --passfile2 ../../var/pass/secret.titi \
  2548. --useheader ALL \
  2549. --skipheader '^X-.*|^Date' --folder INBOX.yop.yap \
  2550. --debug --dry
  2551. }
  2552. ll_include()
  2553. {
  2554. if can_send; then
  2555. #echo3 Here is plume
  2556. sendtestmessage
  2557. else
  2558. :
  2559. fi
  2560. $CMD_PERL ./imapsync \
  2561. --host1 $HOST1 --user1 tata \
  2562. --passfile1 ../../var/pass/secret.tata \
  2563. --host2 $HOST2 --user2 titi \
  2564. --passfile2 ../../var/pass/secret.titi \
  2565. --include '^INBOX.yop'
  2566. }
  2567. ll_include_include()
  2568. {
  2569. if can_send; then
  2570. #echo3 Here is plume
  2571. sendtestmessage
  2572. else
  2573. :
  2574. fi
  2575. $CMD_PERL ./imapsync \
  2576. --host1 $HOST1 --user1 tata \
  2577. --passfile1 ../../var/pass/secret.tata \
  2578. --host2 $HOST2 --user2 titi \
  2579. --passfile2 ../../var/pass/secret.titi \
  2580. --nofoldersizes \
  2581. --include '^INBOX.yop' --include '^INBOX.'
  2582. }
  2583. ll_include_exclude()
  2584. {
  2585. if can_send; then
  2586. #echo3 Here is plume
  2587. sendtestmessage
  2588. else
  2589. :
  2590. fi
  2591. $CMD_PERL ./imapsync \
  2592. --host1 $HOST1 --user1 tata \
  2593. --passfile1 ../../var/pass/secret.tata \
  2594. --host2 $HOST2 --user2 titi \
  2595. --passfile2 ../../var/pass/secret.titi \
  2596. --nofoldersizes \
  2597. --include '^INBOX.yop' --exclude '^INBOX.'
  2598. }
  2599. ll_exclude()
  2600. {
  2601. $CMD_PERL ./imapsync \
  2602. --host1 $HOST1 --user1 tata \
  2603. --passfile1 ../../var/pass/secret.tata \
  2604. --host2 $HOST2 --user2 titi \
  2605. --passfile2 ../../var/pass/secret.titi \
  2606. --exclude '^(?i)INBOX.YOP' --justfolders --nofoldersizes
  2607. }
  2608. ll_exclude_2()
  2609. {
  2610. $CMD_PERL ./imapsync \
  2611. --host1 $HOST1 --user1 tata \
  2612. --passfile1 ../../var/pass/secret.tata \
  2613. --host2 $HOST2 --user2 titi \
  2614. --passfile2 ../../var/pass/secret.titi \
  2615. --exclude '^INBOX.yop$' --justfolders --nofoldersizes
  2616. }
  2617. ll_exclude_INBOX()
  2618. {
  2619. $CMD_PERL ./imapsync \
  2620. --host1 $HOST1 --user1 tata \
  2621. --passfile1 ../../var/pass/secret.tata \
  2622. --host2 $HOST2 --user2 titi \
  2623. --passfile2 ../../var/pass/secret.titi \
  2624. --exclude '^INBOX' --justfolders --nofoldersizes --dry
  2625. }
  2626. ll_exclude_blanc_middle()
  2627. {
  2628. $CMD_PERL ./imapsync \
  2629. --host1 $HOST1 --user1 tata \
  2630. --passfile1 ../../var/pass/secret.tata \
  2631. --host2 $HOST2 --user2 titi \
  2632. --passfile2 ../../var/pass/secret.titi \
  2633. --exclude '^INBOX.blanc\smiddle' --justfolders --nofoldersizes --dry
  2634. }
  2635. ll_f1f2_01()
  2636. {
  2637. $CMD_PERL ./imapsync \
  2638. --host1 $HOST1 --user1 tata \
  2639. --passfile1 ../../var/pass/secret.tata \
  2640. --host2 $HOST2 --user2 titi \
  2641. --passfile2 ../../var/pass/secret.titi \
  2642. --justfolders \
  2643. --folder 'INBOX.yop.yap' --f1f2 'INBOX.yop.yap=INBOX/rha/lovely' --f1f2 'lalala=lululu' --debugfolders
  2644. test "$EXIT_ERR_CREATE" = "$?"
  2645. }
  2646. ll_regextrans2()
  2647. {
  2648. $CMD_PERL ./imapsync \
  2649. --host1 $HOST1 --user1 tata \
  2650. --passfile1 ../../var/pass/secret.tata \
  2651. --host2 $HOST2 --user2 titi \
  2652. --passfile2 ../../var/pass/secret.titi \
  2653. --justfolders \
  2654. --regextrans2 's/yop/yoX/' \
  2655. --folder 'INBOX.yop.yap' --debug
  2656. }
  2657. ll_add_suffix()
  2658. {
  2659. $CMD_PERL ./imapsync \
  2660. --host1 $HOST1 --user1 tata \
  2661. --passfile1 ../../var/pass/secret.tata \
  2662. --host2 $HOST2 --user2 titi \
  2663. --passfile2 ../../var/pass/secret.titi \
  2664. --justfolders \
  2665. --regextrans2 's,$,\@easterngraphics.com,' \
  2666. --folderrec 'INBOX.yop' --dry --justfolders
  2667. }
  2668. ll_regextrans2_ucfirst_downcase_last_folder()
  2669. {
  2670. # lowercase the last basename part
  2671. # [INBOX.yop.YAP] -> [INBOX.yop.Yap] using re
  2672. # [INBOX.yop.YAP] -> [INBOX.yop.Yap]
  2673. # \l lowercase next char (think vi)
  2674. # \u uppercase next char (think vi)
  2675. # \L lowercase till \E (think vi)
  2676. # \U uppercase till \E (think vi)
  2677. # \E end case modification (think vi)
  2678. # \Q quote (disable) pattern metacharacters till \E
  2679. $CMD_PERL ./imapsync \
  2680. --host1 $HOST1 --user1 tata \
  2681. --passfile1 ../../var/pass/secret.tata \
  2682. --host2 $HOST2 --user2 titi \
  2683. --passfile2 ../../var/pass/secret.titi \
  2684. --justfolders \
  2685. --nofoldersizes \
  2686. --regextrans2 's,(.*)\.(.+)$,$1.\u\L$2\E,' \
  2687. --folder 'INBOX.yop.YAP' --justfolders --debug --dry
  2688. }
  2689. ll_regextrans2_ucfirst_downcase_all_folders()
  2690. {
  2691. # lowercase the last basename part
  2692. $CMD_PERL ./imapsync \
  2693. --host1 $HOST1 --user1 tata \
  2694. --passfile1 ../../var/pass/secret.tata \
  2695. --host2 $HOST2 --user2 titi \
  2696. --passfile2 ../../var/pass/secret.titi \
  2697. --justfolders \
  2698. --nofoldersizes \
  2699. --regextrans2 's,([^.]+),\u\L$1\E,g' \
  2700. --folder 'INBOX.yop.YAP' --justfolders --debug --dry
  2701. }
  2702. ll_regextrans2_slash()
  2703. {
  2704. $CMD_PERL ./imapsync \
  2705. --host1 $HOST1 --user1 tata \
  2706. --passfile1 ../../var/pass/secret.tata \
  2707. --host2 $HOST2 --user2 titi \
  2708. --passfile2 ../../var/pass/secret.titi \
  2709. --justfolders \
  2710. --nofoldersizes \
  2711. --folder 'INBOX.yop.yap' \
  2712. --sep1 '/' \
  2713. --regextrans2 's,/,_,'
  2714. }
  2715. ll_regextrans2_dot()
  2716. {
  2717. $CMD_PERL ./imapsync \
  2718. --host1 $HOST1 --user1 tata \
  2719. --passfile1 ../../var/pass/secret.tata \
  2720. --host2 $HOST2 --user2 titi \
  2721. --passfile2 ../../var/pass/secret.titi \
  2722. --justfolders \
  2723. --folder 'INBOX.yop.yap' \
  2724. --regextrans2 "s,\.,_,g" --dry
  2725. }
  2726. ll_subfolder2()
  2727. {
  2728. $CMD_PERL ./imapsync \
  2729. --host1 $HOST1 --user1 tata \
  2730. --passfile1 ../../var/pass/secret.tata \
  2731. --host2 $HOST2 --user2 titi \
  2732. --passfile2 ../../var/pass/secret.titi \
  2733. --justfolders --foldersizesatend \
  2734. --subfolder2 SUB
  2735. }
  2736. ll_subfolder1()
  2737. {
  2738. # reverse of ll_subfolder2
  2739. $CMD_PERL ./imapsync \
  2740. --host1 $HOST2 --user1 titi \
  2741. --passfile1 ../../var/pass/secret.titi \
  2742. --host2 $HOST1 --user2 tata \
  2743. --passfile2 ../../var/pass/secret.tata \
  2744. --justfolders \
  2745. --subfolder1 SUB --dry
  2746. }
  2747. ll_subfolder1_INBOX_SUB()
  2748. {
  2749. # reverse of ll_subfolder2
  2750. $CMD_PERL ./imapsync \
  2751. --host1 $HOST2 --user1 titi \
  2752. --passfile1 ../../var/pass/secret.titi \
  2753. --host2 $HOST1 --user2 tata \
  2754. --passfile2 ../../var/pass/secret.tata \
  2755. --justfolders \
  2756. --subfolder1 INBOX.SUB --dry
  2757. }
  2758. ll_subfolder1_DOES_NOT_EXIST()
  2759. {
  2760. # --subfolder1 does not exist
  2761. ! $CMD_PERL ./imapsync \
  2762. --host1 $HOST2 --user1 titi \
  2763. --passfile1 ../../var/pass/secret.titi \
  2764. --host2 $HOST1 --user2 tata \
  2765. --passfile2 ../../var/pass/secret.tata \
  2766. --justfolders \
  2767. --subfolder1 DOES_NOT_EXIST --dry
  2768. }
  2769. ll_nochildren()
  2770. {
  2771. $CMD_PERL ./imapsync \
  2772. --host1 $HOST1 --user1 tata \
  2773. --passfile1 ../../var/pass/secret.tata \
  2774. --host2 w00d0310.kasserver.com --user2 m0331832 \
  2775. --passfile2 ../../var/pass/secret.kasserver \
  2776. --folderrec INBOX.A --subfolder2 inferior_top_level
  2777. }
  2778. ll_regextrans2_remove_space()
  2779. {
  2780. $CMD_PERL ./imapsync \
  2781. --host1 $HOST1 --user1 tata \
  2782. --passfile1 ../../var/pass/secret.tata \
  2783. --host2 $HOST2 --user2 titi \
  2784. --passfile2 ../../var/pass/secret.titi \
  2785. --justfolders \
  2786. --nofoldersizes \
  2787. --folder 'INBOX.yop.y p' \
  2788. --regextrans2 's, ,,' \
  2789. --dry
  2790. }
  2791. ll_regextrans2_archive_per_month()
  2792. {
  2793. # Bad behavior on Courier
  2794. # SENTBEFORE 31-Apr returns nothing
  2795. # SENTBEFORE 30 Apr returns messages
  2796. year=2012
  2797. month=Apr
  2798. month_n=04
  2799. $CMD_PERL ./imapsync \
  2800. --host1 $HOST1 --user1 tata \
  2801. --passfile1 ../../var/pass/secret.tata \
  2802. --host2 $HOST2 --user2 titi \
  2803. --passfile2 ../../var/pass/secret.titi \
  2804. --nofoldersizes \
  2805. --search "SENTSINCE 1-$month-$year SENTBEFORE 30-$month-$year" \
  2806. --regextrans2 "s{.*}{INBOX.Archive.$year.$month_n}"
  2807. }
  2808. ll_regextrans2_archive_per_year_flat_hard_year()
  2809. {
  2810. year=
  2811. $CMD_PERL ./imapsync \
  2812. --host1 $HOST1 --user1 tata \
  2813. --passfile1 ../../var/pass/secret.tata \
  2814. --host2 $HOST2 --user2 titi \
  2815. --passfile2 ../../var/pass/secret.titi \
  2816. --nofoldersizes \
  2817. --search "SENTSINCE 1-1-$year SENTBEFORE 30-12-2018" \
  2818. --sep2 _ --regextrans2 's{(.*)}{Archive_$1_2018}' --justfolders --dry
  2819. }
  2820. ll_regextrans2_archive_per_year_flat_variable_year()
  2821. {
  2822. year=2018
  2823. $CMD_PERL ./imapsync \
  2824. --host1 $HOST1 --user1 tata \
  2825. --passfile1 ../../var/pass/secret.tata \
  2826. --host2 $HOST2 --user2 titi \
  2827. --passfile2 ../../var/pass/secret.titi \
  2828. --nofoldersizes \
  2829. --search "SENTSINCE 1-1-$year SENTBEFORE 30-12-$year" \
  2830. --sep2 _ --regextrans2 's{(.*)}{Archive_$1_'"$year}" --justfolders --dry
  2831. }
  2832. ll_regextrans2_ALLIN()
  2833. {
  2834. $CMD_PERL ./imapsync \
  2835. --host1 $HOST1 --user1 tata \
  2836. --passfile1 ../../var/pass/secret.tata \
  2837. --host2 $HOST2 --user2 titi \
  2838. --passfile2 ../../var/pass/secret.titi \
  2839. --regextrans2 's/.*/INBOX.ALLIN/' \
  2840. --folderrec 'INBOX.yop' --delete2
  2841. }
  2842. ll_regextrans2_ALLIN_usecache()
  2843. {
  2844. $CMD_PERL ./imapsync \
  2845. --host1 $HOST1 --user1 tata \
  2846. --passfile1 ../../var/pass/secret.tata \
  2847. --host2 $HOST2 --user2 titi \
  2848. --passfile2 ../../var/pass/secret.titi \
  2849. --regextrans2 's/.*/INBOX.ALLIN/' \
  2850. --folderrec 'INBOX.yop' --delete2 --usecache --nodelete2duplicates
  2851. }
  2852. ll_regextrans2_ALLIN_fake()
  2853. {
  2854. $CMD_PERL ./imapsync \
  2855. --host1 $HOST1 --user1 tata \
  2856. --passfile1 ../../var/pass/secret.tata \
  2857. --host2 $HOST2 --user2 titi \
  2858. --passfile2 ../../var/pass/secret.titi \
  2859. --regextrans2 's/.*/INBOX.ALLIN/' \
  2860. --foldersizes \
  2861. --folderrec 'INBOX.yop' --delete2
  2862. }
  2863. ll_regextrans2_ALLIN_useuid()
  2864. {
  2865. $CMD_PERL ./imapsync \
  2866. --host1 $HOST1 --user1 tata \
  2867. --passfile1 ../../var/pass/secret.tata \
  2868. --host2 $HOST2 --user2 titi \
  2869. --passfile2 ../../var/pass/secret.titi \
  2870. --foldersizes \
  2871. --regextrans2 's/.*/INBOX.ALLIN/' \
  2872. --folderrec 'INBOX.yop' --delete2 --useuid
  2873. }
  2874. ll_sep2()
  2875. {
  2876. $CMD_PERL ./imapsync \
  2877. --host1 $HOST1 --user1 tata \
  2878. --passfile1 ../../var/pass/secret.tata \
  2879. --host2 $HOST2 --user2 titi \
  2880. --passfile2 ../../var/pass/secret.titi \
  2881. --folder INBOX.yop.yap \
  2882. --sep2 '\\' --dry
  2883. }
  2884. ll_bad_login()
  2885. {
  2886. ! $CMD_PERL ./imapsync \
  2887. --host1 $HOST1 --user1 tata \
  2888. --passfile1 ../../var/pass/secret.toto \
  2889. --host2 $HOST2 --user2 notiti \
  2890. --passfile2 ../../var/pass/secret.titi
  2891. }
  2892. ll_authentication_failure_user1() {
  2893. $CMD_PERL ./imapsync \
  2894. --host1 $HOST1 --user1 tata \
  2895. --password1 wrong \
  2896. --host2 $HOST2 --user2 titi \
  2897. --passfile2 ../../var/pass/secret.titi
  2898. test "$?" = "$EXIT_AUTHENTICATION_FAILURE_USER1"
  2899. }
  2900. ll_authentication_failure_user2() {
  2901. $CMD_PERL ./imapsync \
  2902. --host1 $HOST1 --user1 tata \
  2903. --passfile1 ../../var/pass/secret.tata \
  2904. --host2 $HOST2 --user2 titi \
  2905. --password2 wrong
  2906. test "$?" = "$EXIT_AUTHENTICATION_FAILURE_USER2"
  2907. }
  2908. ll_authentication_failure_user12() {
  2909. $CMD_PERL ./imapsync \
  2910. --host1 $HOST1 --user1 tata \
  2911. --password1 wrong \
  2912. --host2 $HOST2 --user2 titi \
  2913. --password2 wrong
  2914. test "$?" = "$EXIT_AUTHENTICATION_FAILURE_USER1"
  2915. }
  2916. ll_bad_host1()
  2917. {
  2918. $CMD_PERL ./imapsync \
  2919. --host1 badhostkaka --user1 tata \
  2920. --passfile1 ../../var/pass/secret.tata \
  2921. --host2 $HOST2 --user2 titi \
  2922. --passfile2 ../../var/pass/secret.titi
  2923. test "$EXIT_CONNECTION_FAILURE_HOST1" = "$?"
  2924. }
  2925. ll_bad_host2()
  2926. {
  2927. $CMD_PERL ./imapsync \
  2928. --host1 $HOST1 --user1 tata \
  2929. --passfile1 ../../var/pass/secret.tata \
  2930. --host2 badhostkiki --user2 titi \
  2931. --passfile2 ../../var/pass/secret.titi
  2932. test "$EXIT_CONNECTION_FAILURE_HOST2" = "$?"
  2933. }
  2934. ll_bad_host12()
  2935. {
  2936. $CMD_PERL ./imapsync \
  2937. --host1 badhostkaka --user1 tata \
  2938. --passfile1 ../../var/pass/secret.tata \
  2939. --host2 badhostkiki --user2 titi \
  2940. --passfile2 ../../var/pass/secret.titi
  2941. test "$EXIT_CONNECTION_FAILURE_HOST1" = "$?"
  2942. }
  2943. ll_bad_host_ssl()
  2944. {
  2945. ! $CMD_PERL ./imapsync \
  2946. --host1 badhost --user1 toto \
  2947. --passfile1 ../../var/pass/secret.toto \
  2948. --host2 badhost --user2 titi \
  2949. --passfile2 ../../var/pass/secret.titi \
  2950. --ssl1 --ssl2
  2951. }
  2952. ll_useheader()
  2953. {
  2954. $CMD_PERL ./imapsync \
  2955. --host1 $HOST1 --user1 tata \
  2956. --passfile1 ../../var/pass/secret.tata \
  2957. --host2 $HOST2 --user2 titi \
  2958. --passfile2 ../../var/pass/secret.titi \
  2959. --folder INBOX.yop.yap \
  2960. --useheader 'Message-ID' \
  2961. --dry --debug
  2962. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  2963. }
  2964. ll_useheader_Received()
  2965. {
  2966. $CMD_PERL ./imapsync \
  2967. --host1 $HOST1 --user1 tata \
  2968. --passfile1 ../../var/pass/secret.tata \
  2969. --host2 $HOST2 --user2 titi \
  2970. --passfile2 ../../var/pass/secret.titi \
  2971. --folder INBOX.yop.yap \
  2972. --useheader 'Received' \
  2973. --dry --debug
  2974. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  2975. }
  2976. ll_useheader_Message_ID_Received()
  2977. {
  2978. $CMD_PERL ./imapsync \
  2979. --host1 $HOST1 --user1 tata \
  2980. --passfile1 ../../var/pass/secret.tata \
  2981. --host2 $HOST2 --user2 titi \
  2982. --passfile2 ../../var/pass/secret.titi \
  2983. --folder INBOX.yop.yap \
  2984. --useheader 'Received' --useheader 'Message-ID' \
  2985. --dry --debug
  2986. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  2987. }
  2988. ll_useheader_noheader()
  2989. {
  2990. $CMD_PERL ./imapsync \
  2991. --host1 $HOST1 --user1 tata \
  2992. --passfile1 ../../var/pass/secret.tata \
  2993. --host2 $HOST2 --user2 titi \
  2994. --passfile2 ../../var/pass/secret.titi \
  2995. --folder INBOX.yop.yap \
  2996. --useheader 'NoExist' \
  2997. --debug --delete2 --addheader
  2998. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  2999. }
  3000. ll_skipmess()
  3001. {
  3002. if can_send; then
  3003. #echo3 Here is plume
  3004. sendtestmessage tata
  3005. fi
  3006. sendtestmessage tata
  3007. $CMD_PERL ./imapsync \
  3008. --host1 $HOST1 --user1 tata \
  3009. --passfile1 ../../var/pass/secret.tata \
  3010. --host2 $HOST2 --user2 titi \
  3011. --passfile2 ../../var/pass/secret.titi \
  3012. --folder INBOX --nofoldersizes \
  3013. --skipmess 'm{.*}ism'
  3014. }
  3015. ll_skipmess_8bits()
  3016. {
  3017. if can_send; then
  3018. #echo3 Here is plume
  3019. SUBJ="`echo -e 'xFF:\0277'`"
  3020. sendtestmessage tata "$SUBJ"
  3021. fi
  3022. #return
  3023. $CMD_PERL ./imapsync \
  3024. --host1 $HOST1 --user1 tata \
  3025. --passfile1 ../../var/pass/secret.tata \
  3026. --host2 $HOST2 --user2 titi \
  3027. --passfile2 ../../var/pass/secret.titi \
  3028. --folder INBOX --nofoldersizes --noreleasecheck \
  3029. --skipmess 'm/[\x80-\xff]/'
  3030. }
  3031. ll_skipmess_Content_Type_Message_partial()
  3032. {
  3033. $CMD_PERL ./imapsync \
  3034. --host1 $HOST1 --user1 tata \
  3035. --passfile1 ../../var/pass/secret.tata \
  3036. --host2 $HOST2 --user2 titi \
  3037. --passfile2 ../../var/pass/secret.titi \
  3038. --folder INBOX.partial --nofoldersizes --noreleasecheck \
  3039. --skipmess 'm{\A((?:[^\n]+\r\n)+|)^Content-Type: Message/Partial;[^\n]*\n(?:\r\n|.*\r\n\r\n)}ism' --dry --addheader
  3040. echo "sudo rm -rf /home/vmail/titi/.partial/cur/*"
  3041. # --skipmess 'm{\A((?:[^\n]+\n)+|)^Content-Type: Message/Partial;[^\n]*\n(?:\r?\n|.*\r?\n\r?\n)}ism' --dry --addheader
  3042. }
  3043. ll_skipmess_not_From()
  3044. {
  3045. sendtestmessage tata
  3046. $CMD_PERL ./imapsync \
  3047. --host1 $HOST1 --user1 tata \
  3048. --passfile1 ../../var/pass/secret.tata \
  3049. --host2 $HOST2 --user2 titi \
  3050. --passfile2 ../../var/pass/secret.titi \
  3051. --folder INBOX --nofoldersizes \
  3052. --skipmess 'm{\A(?!.*^From:[^\n]*tartanpion\@machin\.truc)}xms'
  3053. }
  3054. ll_regexmess()
  3055. {
  3056. if can_send; then
  3057. rm -f /home/vmail/titi/.yop.yap/cur/*
  3058. fi
  3059. # \157 is octal for o
  3060. $CMD_PERL ./imapsync \
  3061. --host1 $HOST1 --user1 tata \
  3062. --passfile1 ../../var/pass/secret.tata \
  3063. --host2 $HOST2 --user2 titi \
  3064. --passfile2 ../../var/pass/secret.titi \
  3065. --folder INBOX.yop.yap \
  3066. --regexmess 's/\157/O/g' \
  3067. --regexmess 's/p/Z/g' \
  3068. --debug
  3069. if can_send; then
  3070. file=`ls -t /home/vmail/titi/.yop.yap/cur/* | tail -1`
  3071. diff ../../var/imapsync/tests/ll_regexmess/dest_01 $file
  3072. echo 'sudo rm -fv /home/vmail/titi/.yop.yap/cur/*'
  3073. fi
  3074. }
  3075. ll_regexmess_8bit_X()
  3076. {
  3077. if can_send; then
  3078. rm -f /home/vmail/titi/.oneemail/cur/*
  3079. fi
  3080. # All f should become X
  3081. $CMD_PERL ./imapsync \
  3082. --host1 $HOST1 --user1 tata \
  3083. --passfile1 ../../var/pass/secret.tata \
  3084. --host2 $HOST2 --user2 titi \
  3085. --passfile2 ../../var/pass/secret.titi \
  3086. --folder INBOX.oneemail \
  3087. --regexmess 'tr [f] [\x99]' \
  3088. --regexmess 'tr [\x80-\xff] [X]' \
  3089. --debug
  3090. }
  3091. ll_regexmess_add_CRLF_if_needed()
  3092. {
  3093. if can_send; then
  3094. rm -f /home/vmail/titi/.oneemail/cur/*
  3095. fi
  3096. # The first one is to be in the case of missing the last \r\n
  3097. # it actually removes it. The second one is the fix.
  3098. $CMD_PERL ./imapsync \
  3099. --host1 $HOST1 --user1 tata \
  3100. --passfile1 ../../var/pass/secret.tata \
  3101. --host2 $HOST2 --user2 titi \
  3102. --passfile2 ../../var/pass/secret.titi \
  3103. --folder INBOX.oneemail \
  3104. --regexmess "s{\r\n\z}{}gxms" \
  3105. --regexmess "s{(?<![\n])\z}{\r\n}gxms" \
  3106. --debug
  3107. }
  3108. ll_regexmess_bad_regex()
  3109. {
  3110. ! $CMD_PERL ./imapsync \
  3111. --host1 $HOST1 --user1 tata \
  3112. --passfile1 ../../var/pass/secret.tata \
  3113. --host2 $HOST2 --user2 titi \
  3114. --passfile2 ../../var/pass/secret.titi \
  3115. --folder INBOX.yop.yap \
  3116. --regexmess 'I am BAD'
  3117. }
  3118. ll_regexmess_trailing_NUL()
  3119. {
  3120. if can_send; then
  3121. rm -fv /home/vmail/titi/.NUL_char/cur/*
  3122. echo /home/vmail/tata/.NUL_char/cur/*
  3123. fi
  3124. $CMD_PERL ./imapsync \
  3125. --host1 $HOST1 --user1 tata \
  3126. --passfile1 ../../var/pass/secret.tata \
  3127. --host2 $HOST2 --user2 titi \
  3128. --passfile2 ../../var/pass/secret.titi \
  3129. --folder INBOX.NUL_char \
  3130. --debugcontent \
  3131. --regexmess 's/(\x00)+\Z//g'
  3132. if can_send; then
  3133. file=`ls -t /home/vmail/titi/.NUL_char/cur/* | tail -1`
  3134. diff ../../var/imapsync/tests/ll_regexmess/dest_02_null_removed $file
  3135. #echo 'sudo rm -fv /home/vmail/titi/.NUL_char/cur/*'
  3136. fi
  3137. }
  3138. ll_regexmess_add_header()
  3139. {
  3140. if at_home; then
  3141. rm -f /home/vmail/titi/.yop.yap/cur/*
  3142. fi
  3143. $CMD_PERL ./imapsync \
  3144. --host1 $HOST1 --user1 tata \
  3145. --passfile1 ../../var/pass/secret.tata \
  3146. --host2 $HOST2 --user2 titi \
  3147. --passfile2 ../../var/pass/secret.titi \
  3148. --folder INBOX.yop.yap \
  3149. --regexmess 's/\A/X-migrated-from-foo: 20100617\n/' \
  3150. --search 'SUBJECT add_some_header_please' \
  3151. --debugcontent
  3152. if at_home; then
  3153. file=`ls -t /home/vmail/titi/.yop.yap/cur/* | tail -1`
  3154. diff W/t/07_ll_regexmess_add_header.txt $file || return 1
  3155. echo 'sudo rm -fv /home/vmail/titi/.yop.yap/cur/*'
  3156. fi
  3157. }
  3158. ll_regexmess_add_header_path()
  3159. {
  3160. if at_home; then
  3161. rm -fv "/home/vmail/titi/.yop.blanc blanc/cur/"*
  3162. fi
  3163. $CMD_PERL ./imapsync \
  3164. --host1 $HOST1 --user1 tata \
  3165. --passfile1 ../../var/pass/secret.tata \
  3166. --host2 $HOST2 --user2 titi \
  3167. --passfile2 ../../var/pass/secret.titi \
  3168. --folder "INBOX.yop.blanc blanc" \
  3169. --regexmess 's/\A/X-ImapSync-OriginalPath-$sync->{user1}: $sync->{ h1_current_folder }\n/' \
  3170. --search 'SUBJECT add_some_header_please' \
  3171. --debugcontent
  3172. if at_home; then
  3173. file=`ls -t "/home/vmail/titi/.yop.blanc blanc/cur/"* | tail -1`
  3174. diff W/t/08_ll_regexmess_add_header_path.txt "$file" || return 1
  3175. echo 'sudo rm -fv "/home/vmail/titi/.yop.blanc blanc/cur/"*'
  3176. fi
  3177. }
  3178. ll_regexmess_add_header_path_verif()
  3179. {
  3180. $CMD_PERL ./imapsync \
  3181. --host1 $HOST1 --user1 titi \
  3182. --passfile1 ../../var/pass/secret.titi \
  3183. --host2 $HOST2 --user2 tata \
  3184. --passfile2 ../../var/pass/secret.tata \
  3185. --folder "INBOX.yop.blanc blanc" \
  3186. --search1 'HEADER X-ImapSync-OriginalPath-tata ""' \
  3187. --debugcontent --dry --useuid --debugimap1
  3188. $CMD_PERL ./imapsync \
  3189. --host1 $HOST1 --user1 titi \
  3190. --passfile1 ../../var/pass/secret.titi \
  3191. --host2 $HOST2 --user2 tata \
  3192. --passfile2 ../../var/pass/secret.tata \
  3193. --folder "INBOX.yop.blanc blanc" \
  3194. --search1 'HEADER X-ImapSync-OriginalPath-tata "INBOX.yop.blanc blanc"' \
  3195. --debugcontent --dry --useuid --debugimap1
  3196. }
  3197. ll_regexmess_change_header()
  3198. {
  3199. #
  3200. if at_home; then
  3201. rm -f /home/vmail/titi/.yop.yap/cur/*
  3202. fi
  3203. $CMD_PERL ./imapsync \
  3204. --host1 $HOST1 --user1 tata \
  3205. --passfile1 ../../var/pass/secret.tata \
  3206. --host2 $HOST2 --user2 titi \
  3207. --passfile2 ../../var/pass/secret.titi \
  3208. --folder INBOX.yop.yap \
  3209. --regexmess 's{\A(.*?(?! ^$))^Date:\ \(Invalid\)(.*?)$}{$1Date: Thu, 1 Jun 2017 23:59:59 +0000}xms' \
  3210. --search "HEADER Date Invalid" \
  3211. --debugcontent --dry
  3212. }
  3213. ll_regexmess_truncate_long_message_regex()
  3214. {
  3215. #
  3216. if at_home; then
  3217. rm -f /home/vmail/titi/.yop.yap/cur/*
  3218. fi
  3219. # Does not work
  3220. ! $CMD_PERL ./imapsync \
  3221. --host1 $HOST1 --user1 tata \
  3222. --passfile1 ../../var/pass/secret.tata \
  3223. --host2 $HOST2 --user2 titi \
  3224. --passfile2 ../../var/pass/secret.titi \
  3225. --folder INBOX.yop.yap \
  3226. --regexmess 's/.{40000}\K.*//s' \
  3227. --debugcontent --minsize 100000
  3228. # Quantifier in {,} bigger than 32766 in regex; marked by <-- HERE in m/.{ <-- HERE 40000}
  3229. }
  3230. ll_regexmess_truncate_long_message_substr()
  3231. {
  3232. #
  3233. if at_home; then
  3234. rm -f /home/vmail/titi/.yop.yap/cur/*
  3235. fi
  3236. # Works well
  3237. $CMD_PERL ./imapsync \
  3238. --host1 $HOST1 --user1 tata \
  3239. --passfile1 ../../var/pass/secret.tata \
  3240. --host2 $HOST2 --user2 titi \
  3241. --passfile2 ../../var/pass/secret.titi \
  3242. --folder INBOX.yop.yap \
  3243. --pipemess 'perl -0ne "print substr \$_,0,40000" ' \
  3244. --debugcontent --minsize 100000
  3245. }
  3246. ll_regexmess_truncate_long_message_truncmess()
  3247. {
  3248. #
  3249. if at_home; then
  3250. rm -f /home/vmail/titi/.yop.yap/cur/*
  3251. fi
  3252. # Works well
  3253. $CMD_PERL ./imapsync \
  3254. --host1 $HOST1 --user1 tata \
  3255. --passfile1 ../../var/pass/secret.tata \
  3256. --host2 $HOST2 --user2 titi \
  3257. --passfile2 ../../var/pass/secret.titi \
  3258. --folder INBOX.yop.yap \
  3259. --truncmess 40000 \
  3260. --debugcontent --minsize 100000
  3261. }
  3262. ll_search_not_header() {
  3263. $CMD_PERL ./imapsync \
  3264. --host1 $HOST1 --user1 tata \
  3265. --passfile1 ../../var/pass/secret.tata \
  3266. --host2 $HOST2 --user2 titi \
  3267. --passfile2 ../../var/pass/secret.titi \
  3268. --folder INBOX.yop.yap \
  3269. --search "NOT HEADER Date Invalid" --debugcontent --dry
  3270. }
  3271. ll_regexmess_remove_header_Disposition()
  3272. {
  3273. #Disposition-Notification-To: Gilles LAMIRAL <gilles@lamiral.info>
  3274. $CMD_PERL ./imapsync \
  3275. --host1 $HOST1 --user1 tata \
  3276. --passfile1 ../../var/pass/secret.tata \
  3277. --host2 $HOST2 --user2 titi \
  3278. --passfile2 ../../var/pass/secret.titi \
  3279. --folder INBOX.regexmess \
  3280. --nofoldersizes \
  3281. --regexmess 's{\A(.*?(?! ^$))(^Disposition-Notification-To:.*?\n)}{$1}gxms' \
  3282. --debugcontent --debug
  3283. echo "sudo sh -c 'rm /home/vmail/titi/.regexmess/cur/*'"
  3284. }
  3285. ll_disarmreadreceipts()
  3286. {
  3287. #Disposition-Notification-To: Gilles LAMIRAL <gilles@lamiral.info>
  3288. $CMD_PERL ./imapsync \
  3289. --host1 $HOST1 --user1 tata \
  3290. --passfile1 ../../var/pass/secret.tata \
  3291. --host2 $HOST2 --user2 titi \
  3292. --passfile2 ../../var/pass/secret.titi \
  3293. --folder INBOX.disarm \
  3294. --nofoldersizes \
  3295. --disarmreadreceipts \
  3296. --debugcontent --debug --dry
  3297. echo "sudo sh -c 'rm /home/vmail/titi/.disarm/cur/*'"
  3298. }
  3299. ll_regexmess_scwchu()
  3300. {
  3301. $CMD_PERL ./imapsync \
  3302. --host1 $HOST1 --user1 tata \
  3303. --passfile1 ../../var/pass/secret.tata \
  3304. --host2 $HOST2 --user2 titi \
  3305. --passfile2 ../../var/pass/secret.titi \
  3306. --folder INBOX.scwchu \
  3307. --regexmess 's{\A(.*?(?! ^$))^Date:(.*?)$}{$1Date:$2\nReceived: From; $2}gxms' \
  3308. --skipsize --skipheader 'Received: From;' \
  3309. --debug
  3310. echo 'rm /home/vmail/titi/.scwchu/cur/*'
  3311. }
  3312. ll_regexmess_wong()
  3313. {
  3314. $CMD_PERL ./imapsync \
  3315. --host1 $HOST1 --user1 tata \
  3316. --passfile1 ../../var/pass/secret.tata \
  3317. --host2 $HOST2 --user2 titi \
  3318. --passfile2 ../../var/pass/secret.titi \
  3319. --folder INBOX.scwchu \
  3320. --regexmess 's{\A}{Content-Type: text/plain; charset="big5"\n}gxms' \
  3321. --debugcontent --debug
  3322. echo "sudo sh -c 'rm /home/vmail/titi/.scwchu/cur/*'"
  3323. }
  3324. ll_regexmess_wong_2()
  3325. {
  3326. #Received: from hkuhp22.hku.hk
  3327. $CMD_PERL ./imapsync \
  3328. --host1 $HOST1 --user1 tata \
  3329. --passfile1 ../../var/pass/secret.tata \
  3330. --host2 $HOST2 --user2 titi \
  3331. --passfile2 ../../var/pass/secret.titi \
  3332. --folder INBOX.scwchu \
  3333. --regexmess 's{\A(.*?(?!^$))^(Received: from hkuhp22.hku.hk.*?)$}{$1Content-Type: text/plain; charset="big5"\n$2}gms' \
  3334. --debugcontent --debug --dry
  3335. echo "sudo sh -c 'rm /home/vmail/titi/.scwchu/cur/*'"
  3336. }
  3337. ll_flags()
  3338. {
  3339. $CMD_PERL ./imapsync \
  3340. --host1 $HOST1 --user1 tata \
  3341. --passfile1 ../../var/pass/secret.tata \
  3342. --host2 $HOST2 --user2 titi \
  3343. --passfile2 ../../var/pass/secret.titi \
  3344. --folder INBOX.yop.yap \
  3345. --debugflags
  3346. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  3347. }
  3348. ll_resyncflags()
  3349. {
  3350. $CMD_PERL ./imapsync \
  3351. --host1 $HOST1 --user1 tata \
  3352. --passfile1 ../../var/pass/secret.tata \
  3353. --host2 $HOST2 --user2 titi \
  3354. --passfile2 ../../var/pass/secret.titi \
  3355. --folder INBOX.yop.yap \
  3356. --debugflags --resyncflags | grep 'Host1: flags init msg' || return 1
  3357. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  3358. }
  3359. ll_syncflagsaftercopy()
  3360. {
  3361. # courier doesn't gives the flags just after an copy
  3362. $CMD_PERL ./imapsync \
  3363. --host1 $HOST1 --user1 tata \
  3364. --passfile1 ../../var/pass/secret.tata \
  3365. --host2 $HOST2 --user2 titi \
  3366. --passfile2 ../../var/pass/secret.titi \
  3367. --folder INBOX.yop.yap --nofoldersizes \
  3368. --debugflags --syncflagsaftercopy # | grep 'replacing h2 flags' || return 1
  3369. # | grep 'could not get its flags' || return 1
  3370. echo 'sudo rm /home/vmail/titi/.yop.yap/cur/*'
  3371. }
  3372. ll_noresyncflags()
  3373. {
  3374. $CMD_PERL ./imapsync \
  3375. --host1 $HOST1 --user1 tata \
  3376. --passfile1 ../../var/pass/secret.tata \
  3377. --host2 $HOST2 --user2 titi \
  3378. --passfile2 ../../var/pass/secret.titi \
  3379. --folder INBOX.yop.yap \
  3380. --debugflags --noresyncflags | grep 'Host1: flags init msg' && return 1
  3381. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  3382. }
  3383. ll_regex_flag()
  3384. {
  3385. $CMD_PERL ./imapsync \
  3386. --host1 $HOST1 --user1 tata \
  3387. --passfile1 ../../var/pass/secret.tata \
  3388. --host2 $HOST2 --user2 titi \
  3389. --passfile2 ../../var/pass/secret.titi \
  3390. --folder INBOX.yop.yap \
  3391. --regexflag 's/\\Answered/\$Forwarded/g' --debugflags
  3392. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3393. }
  3394. ll_regex_flag_remove()
  3395. {
  3396. $CMD_PERL ./imapsync \
  3397. --host1 $HOST1 --user1 tata \
  3398. --passfile1 ../../var/pass/secret.tata \
  3399. --host2 $HOST2 --user2 titi \
  3400. --passfile2 ../../var/pass/secret.titi \
  3401. --folder INBOX.yop.yap \
  3402. --regexflag 's/\\Indexed//gi' --debugflags
  3403. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3404. }
  3405. ll_regex_flag_bad()
  3406. {
  3407. ! $CMD_PERL ./imapsync \
  3408. --host1 $HOST1 --user1 tata \
  3409. --passfile1 ../../var/pass/secret.tata \
  3410. --host2 $HOST2 --user2 titi \
  3411. --passfile2 ../../var/pass/secret.titi \
  3412. --folder INBOX.yop.yap \
  3413. --regexflag 'I am bad' --debugflags
  3414. echo 'sudo rm -fv /home/vmail/titi/.yop.yap/cur/*'
  3415. }
  3416. ll_regex_flag2()
  3417. {
  3418. $CMD_PERL ./imapsync \
  3419. --host1 $HOST1 --user1 tata \
  3420. --passfile1 ../../var/pass/secret.tata \
  3421. --host2 $HOST2 --user2 titi \
  3422. --passfile2 ../../var/pass/secret.titi \
  3423. --folder INBOX.yop.yap \
  3424. --debug --regexflag s/\\\\Answered/\\\\Flagged/g
  3425. echo 'sudo rm -fv /home/vmail/titi/.yop.yap/cur/*'
  3426. }
  3427. ll_regex_flag3()
  3428. {
  3429. $CMD_PERL ./imapsync \
  3430. --host1 $HOST1 --user1 tata \
  3431. --passfile1 ../../var/pass/secret.tata \
  3432. --host2 $HOST2 --user2 titi \
  3433. --passfile2 ../../var/pass/secret.titi \
  3434. --folder INBOX.yop.yap \
  3435. --debug --regexflag s/\\\\Answered//g
  3436. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3437. }
  3438. ll_regex_flag4()
  3439. {
  3440. $CMD_PERL ./imapsync \
  3441. --host1 $HOST1 --user1 tata \
  3442. --passfile1 ../../var/pass/secret.tata \
  3443. --host2 $HOST2 --user2 titi \
  3444. --passfile2 ../../var/pass/secret.titi \
  3445. --folder INBOX.yop.yap --nofoldersizes \
  3446. --regexflag 's/\$label1/\\label1/g' \
  3447. --regexflag "s/\\\$Forwarded//g" --debugflags
  3448. echo 'sudo rm -f /home/vmail/titi/.yop.yap/cur/*'
  3449. }
  3450. ll_regex_flag5()
  3451. {
  3452. $CMD_PERL ./imapsync \
  3453. --host1 $HOST1 --user1 tata \
  3454. --passfile1 ../../var/pass/secret.tata \
  3455. --host2 $HOST2 --user2 titi \
  3456. --passfile2 ../../var/pass/secret.titi \
  3457. --folder INBOX.yop.yap \
  3458. --debugflags --regexflag "s/Answered/Flagged/g"
  3459. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3460. }
  3461. ll_regex_flag6_add_SEEN()
  3462. {
  3463. $CMD_PERL ./imapsync \
  3464. --host1 $HOST1 --user1 tata \
  3465. --passfile1 ../../var/pass/secret.tata \
  3466. --host2 $HOST2 --user2 tata \
  3467. --passfile2 ../../var/pass/secret.tata \
  3468. --folder INBOX.flagsetSeen \
  3469. --debugflags --regexflag "s/(.*)/\$1 \\\\Seen/" --dry
  3470. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3471. }
  3472. ll_regex_flag7_add_SEEN()
  3473. {
  3474. $CMD_PERL ./imapsync \
  3475. --host1 $HOST1 --user1 tata \
  3476. --passfile1 ../../var/pass/secret.tata \
  3477. --host2 $HOST2 --user2 titi \
  3478. --passfile2 ../../var/pass/secret.titi \
  3479. --folder INBOX.yop.yap \
  3480. --debugflags --regexflag 's,,\\Seen ,' --dry
  3481. # on windows --regexflag "s,,\\Seen ," --dry
  3482. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3483. }
  3484. ll_regex_flag8_add_SEEN_if_not_here()
  3485. {
  3486. $CMD_PERL ./imapsync \
  3487. --host1 $HOST1 --user1 tata \
  3488. --passfile1 ../../var/pass/secret.tata \
  3489. --host2 $HOST2 --user2 titi \
  3490. --passfile2 ../../var/pass/secret.titi \
  3491. --folder INBOX.flagsetSeen --nofoldersizes \
  3492. --debugflags --dry --regexflag 's,\\Seen,,' --regexflag 's,,\\Seen ,'
  3493. # On windows: --regexflag "s,((?!\\Seen).*),$1 \\Seen,"
  3494. }
  3495. ll_regex_flag8_add_SEEN_always()
  3496. {
  3497. $CMD_PERL ./imapsync \
  3498. --host1 $HOST1 --user1 tata \
  3499. --passfile1 ../../var/pass/secret.tata \
  3500. --host2 $HOST2 --user2 titi \
  3501. --passfile2 ../../var/pass/secret.titi \
  3502. --folder INBOX.flagsetSeen --nofoldersizes \
  3503. --debugflags --dry --regexflag "s,,\\\\Seen ,"
  3504. }
  3505. ll_regex_flag_keep_only()
  3506. {
  3507. $CMD_PERL ./imapsync \
  3508. --host1 $HOST1 --user1 tata \
  3509. --passfile1 ../../var/pass/secret.tata \
  3510. --host2 $HOST2 --user2 titi \
  3511. --passfile2 ../../var/pass/secret.titi \
  3512. --folder INBOX.yop.yap \
  3513. --debug \
  3514. --regexflag 's/(.*)/$1 jrdH8u/' \
  3515. --regexflag 's/.*?(\\Seen|\\Answered|\\Flagged|\\Deleted|\\Draft|jrdH8u)/$1 /g' \
  3516. --regexflag 's/(\\Seen|\\Answered|\\Flagged|\\Deleted|\\Draft|jrdH8u) (?!(\\Seen|\\Answered|\\Flagged|\\Deleted|\\Draft|jrdH8u)).*/$1 /g' \
  3517. --regexflag 's/jrdH8u *//'
  3518. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3519. }
  3520. ll_regex_flag_keep_only_phil()
  3521. {
  3522. $CMD_PERL ./imapsync \
  3523. --host1 $HOST1 --user1 tata \
  3524. --passfile1 ../../var/pass/secret.tata \
  3525. --host2 $HOST2 --user2 titi \
  3526. --passfile2 ../../var/pass/secret.titi \
  3527. --folder INBOX.yop.yap \
  3528. --debugflags \
  3529. --regexflag 's/(.*)/$1 jrdH8u/' \
  3530. --regexflag 's/.*?(?:(\\(?:Answered|Flagged|Deleted|Seen|Draft)\s?)|$)/defined($1)?$1:q()/eg' \
  3531. --regexflag 's/jrdH8u *//'
  3532. echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
  3533. }
  3534. ll_tls_justconnect() {
  3535. $CMD_PERL ./imapsync \
  3536. --host1 $HOST1 \
  3537. --host2 $HOST2 \
  3538. --tls1 --tls2 \
  3539. --justconnect --debugimap
  3540. }
  3541. ll_tls_justconnect_SSL_version() {
  3542. $CMD_PERL ./imapsync \
  3543. --host1 $HOST1 \
  3544. --host2 $HOST2 \
  3545. --tls1 --tls2 \
  3546. --justconnect --debugimap --ssl1_SSL_version SSLv3 --ssl2_SSL_version SSLv2
  3547. }
  3548. ll_tls_justlogin() {
  3549. $CMD_PERL ./imapsync \
  3550. --host1 $HOST1 --user1 tata \
  3551. --passfile1 ../../var/pass/secret.tata \
  3552. --host2 $HOST2 --user2 titi \
  3553. --passfile2 ../../var/pass/secret.titi \
  3554. --tls1 --tls2 \
  3555. --justlogin --debugimap
  3556. }
  3557. ll_tls_devel() {
  3558. ll_justlogin && ll_ssl_justlogin \
  3559. && ll_tls_justconnect && ll_tls_justlogin
  3560. }
  3561. ll_tls() {
  3562. $CMD_PERL ./imapsync \
  3563. --host1 $HOST1 --user1 tata \
  3564. --passfile1 ../../var/pass/secret.tata \
  3565. --host2 $HOST2 --user2 titi \
  3566. --passfile2 ../../var/pass/secret.titi \
  3567. --tls1 --tls2
  3568. }
  3569. ll_ssl_justconnect() {
  3570. $CMD_PERL ./imapsync \
  3571. --host1 $HOST1 \
  3572. --host2 $HOST2 \
  3573. --ssl1 --ssl2 \
  3574. --justconnect
  3575. }
  3576. ll_ssl_justconnect_SSL_version() {
  3577. $CMD_PERL ./imapsync \
  3578. --host1 $HOST1 \
  3579. --host2 $HOST2 \
  3580. --ssl1 --ssl2 \
  3581. --justconnect --ssl1_SSL_version SSLv3 --ssl2_SSL_version SSLv2
  3582. }
  3583. ll_ssl_justconnect_sslargs() {
  3584. $CMD_PERL ./imapsync \
  3585. --host1 $HOST1 \
  3586. --host2 $HOST2 \
  3587. --ssl1 --ssl2 \
  3588. --justconnect --sslargs1 SSL_version=SSLv23 --sslargs1 SSL_verify_mode=0
  3589. }
  3590. ll_ssl_justconnect_sslargs_SSL_verify_mode1() {
  3591. $CMD_PERL ./imapsync \
  3592. --host1 $HOST1 \
  3593. --host2 $HOST2 \
  3594. --ssl1 --ssl2 \
  3595. --justconnect --sslargs1 SSL_version=SSLv23 --sslargs1 SSL_verify_mode=1
  3596. }
  3597. ll_ssl_justconnect_sslargs_SSL_versionTLSv1_1() {
  3598. $CMD_PERL ./imapsync \
  3599. --host1 $HOST1 \
  3600. --host2 $HOST2 \
  3601. --tls1 \
  3602. --justconnect --sslargs1 SSL_version=TLSv1_1 --sslargs1 SSL_verify_mode=0 --debugssl 4
  3603. }
  3604. ll_ssl1_tls2_justconnect() {
  3605. $CMD_PERL ./imapsync \
  3606. --host1 $HOST1 \
  3607. --host2 $HOST2 \
  3608. --ssl1 --tls2 \
  3609. --justconnect --debugimap
  3610. }
  3611. ll_tls1_ssl2_justconnect() {
  3612. $CMD_PERL ./imapsync \
  3613. --host1 $HOST1 \
  3614. --host2 $HOST2 \
  3615. --tls1 --ssl2 \
  3616. --justconnect --debugimap
  3617. }
  3618. ll_ssl1_tls1_justconnect() {
  3619. $CMD_PERL ./imapsync \
  3620. --host1 $HOST1 \
  3621. --host2 $HOST2 \
  3622. --ssl1 --tls1 \
  3623. --justconnect --debugimap
  3624. }
  3625. ll_ssl_justconnect_SSL_VERIFY_PEER() {
  3626. $CMD_PERL ./imapsync \
  3627. --host1 $HOST1 \
  3628. --ssl1 \
  3629. --justconnect \
  3630. --host2 imap.gmail.com \
  3631. --ssl2 \
  3632. --sslargs2 SSL_verify_mode=1
  3633. #--sslargs2 SSL_ca_file=/etc/ssl/certs/ca-certificates.crt
  3634. }
  3635. ll_justconnect_devel() {
  3636. ll_justconnect && ll_tls_justconnect && ll_ssl_justconnect && ll_ssl1_tls2_justconnect && ll_tls1_ssl2_justconnect && ! ll_ssl1_tls1_justconnect
  3637. }
  3638. ll_ssl_justlogin() {
  3639. $CMD_PERL ./imapsync \
  3640. --host1 $HOST1 --user1 tata \
  3641. --passfile1 ../../var/pass/secret.tata \
  3642. --host2 $HOST2 --user2 titi \
  3643. --passfile2 ../../var/pass/secret.titi \
  3644. --ssl1 --ssl2 \
  3645. --justlogin
  3646. }
  3647. ll_ssl_justlogin_SSL_version() {
  3648. $CMD_PERL ./imapsync \
  3649. --host1 $HOST1 --user1 tata \
  3650. --passfile1 ../../var/pass/secret.tata \
  3651. --host2 $HOST2 --user2 titi \
  3652. --passfile2 ../../var/pass/secret.titi \
  3653. --ssl1 --ssl2 \
  3654. --justlogin --ssl1_SSL_version SSLv23 --ssl2_SSL_version SSLv23 --debugssl 4
  3655. }
  3656. ll_ssl_justlogin_sslargs() {
  3657. $CMD_PERL ./imapsync \
  3658. --host1 $HOST1 --user1 tata \
  3659. --passfile1 ../../var/pass/secret.tata \
  3660. --host2 $HOST2 --user2 titi \
  3661. --passfile2 ../../var/pass/secret.titi \
  3662. --ssl1 --ssl2 \
  3663. --sslargs1 SSL_version=SSLv3 --sslargs1 SSL_verify_mode=1
  3664. }
  3665. ll_tls_justlogin_sslargs_failure_EXIT_TLS_FAILURE() {
  3666. $CMD_PERL ./imapsync \
  3667. --host1 $HOST1 --user1 tata \
  3668. --passfile1 ../../var/pass/secret.tata \
  3669. --host2 $HOST2 --user2 titi \
  3670. --passfile2 ../../var/pass/secret.titi \
  3671. --tls1 --tls2 \
  3672. --sslargs1 SSL_version=SSLv2
  3673. test "$?" = "$EXIT_TLS_FAILURE"
  3674. }
  3675. ll_ssl_tls_justlogin() {
  3676. $CMD_PERL ./imapsync \
  3677. --host1 $HOST1 --user1 tata \
  3678. --passfile1 ../../var/pass/secret.tata \
  3679. --host2 $HOST2 --user2 titi \
  3680. --passfile2 ../../var/pass/secret.titi \
  3681. --ssl1 --tls1 --ssl2 --tls2 \
  3682. --justlogin --debug
  3683. test "$?" = "$EXIT_TLS_FAILURE"
  3684. }
  3685. ll_justlogin_devel() {
  3686. ll_justlogin && ll_ssl_justlogin && ll_tls_justlogin && ll_ssl_tls_justlogin
  3687. }
  3688. ll_ssl() {
  3689. if can_send; then
  3690. #echo3 Here is plume
  3691. sendtestmessage
  3692. fi
  3693. $CMD_PERL ./imapsync \
  3694. --host1 $HOST1 --user1 tata \
  3695. --passfile1 ../../var/pass/secret.tata \
  3696. --host2 $HOST2 --user2 titi \
  3697. --passfile2 ../../var/pass/secret.titi \
  3698. --ssl1 --ssl2
  3699. }
  3700. ll_authmech_PLAIN() {
  3701. $CMD_PERL ./imapsync \
  3702. --host1 $HOST1 --user1 tata \
  3703. --passfile1 ../../var/pass/secret.tata \
  3704. --host2 $HOST2 --user2 titi \
  3705. --passfile2 ../../var/pass/secret.titi \
  3706. --justfoldersizes --nofoldersizes \
  3707. --authmech1 PLAIN --authmech2 PLAIN
  3708. }
  3709. ll_authmech_PLAIN_ssl() {
  3710. $CMD_PERL ./imapsync \
  3711. --host1 $HOST1 --ssl1 --user1 tata \
  3712. --passfile1 ../../var/pass/secret.tata \
  3713. --host2 $HOST2 --ssl2 --user2 titi \
  3714. --passfile2 ../../var/pass/secret.titi \
  3715. --justfoldersizes --nofoldersizes \
  3716. --authmech1 PLAIN --authmech2 PLAIN
  3717. }
  3718. ll_authmech_XOAUTH2_gmail() {
  3719. ! ping -c1 imap.gmail.com || { $CMD_PERL ./imapsync \
  3720. --host1 imap.gmail.com --ssl1 --user1 gilles.lamiral@gmail.com \
  3721. --passfile1 ../../var/pass/secret.xoauth2 \
  3722. --host2 imap.gmail.com --ssl2 --user2 gilles.lamiral@gmail.com \
  3723. --passfile2 ../../var/pass/secret.xoauth2 \
  3724. --justlogin \
  3725. --authmech1 XOAUTH2 --authmech2 XOAUTH2 --debug | grep unauthorized_client ; }
  3726. }
  3727. ll_authmech_xoauth2_gmail() { ll_authmech_XOAUTH2_gmail; }
  3728. ll_authmech_XOAUTH2_json_gmail() {
  3729. ! ping -c1 imap.gmail.com || { $CMD_PERL ./imapsync \
  3730. --host1 imap.gmail.com --ssl1 --user1 gilles.lamiral@gmail.com \
  3731. --password1 ../../var/pass/secret.xoauth2.json \
  3732. --host2 imap.gmail.com --ssl2 --user2 gilles.lamiral@gmail.com \
  3733. --password2 ../../var/pass/secret.xoauth2.json \
  3734. --justlogin \
  3735. --authmech1 XOAUTH2 --authmech2 XOAUTH2 --debug | grep unauthorized_client ; }
  3736. }
  3737. ll_authmech_xoauth2_json_gmail() { ll_authmech_XOAUTH2_json_gmail; }
  3738. ll_authmech_XOAUTH2_json_gmail_app() {
  3739. ! ping -c1 imap.gmail.com || { $CMD_PERL ./imapsync \
  3740. --host1 imap.gmail.com --ssl1 --user1 gilles.lamiral@gmail.com \
  3741. --password1 ../../var/pass/secret.xoauth2.json \
  3742. --host2 imap.gmail.com --ssl2 --user2 gilles.lamiral@gmail.com \
  3743. --password2 ../../var/pass/secret.xoauth2.json \
  3744. --justlogin \
  3745. --authmech1 XOAUTH2 --authmech2 XOAUTH2 --debugimap ; }
  3746. }
  3747. ll_authmech_xoauth2_json_gmail_app() { ll_authmech_XOAUTH2_json_gmail_app; }
  3748. ll_authmech_XOAUTH2_gmail_proxy() {
  3749. ! ping -c1 imap.gmail.com || https_proxy=http://localhost:8080/ $CMD_PERL ./imapsync \
  3750. --host1 imap.gmail.com --ssl1 --user1 gilles.lamiral@gmail.com \
  3751. --passfile1 ../../var/pass/secret.xoauth2 \
  3752. --host2 imap.gmail.com --ssl2 --user2 gilles.lamiral@gmail.com \
  3753. --passfile2 ../../var/pass/secret.xoauth2 \
  3754. --justlogin \
  3755. --authmech1 XOAUTH2 --authmech2 XOAUTH2 --debug
  3756. }
  3757. ll_authmech_xoauth2_gmail_proxy() { ll_authmech_XOAUTH2_gmail_proxy; }
  3758. ll_authmech_NTLM() {
  3759. # It fails since I don't have NTLM available
  3760. ! $CMD_PERL ./imapsync \
  3761. --host1 $HOST1 --user1 tata \
  3762. --passfile1 ../../var/pass/secret.tata \
  3763. --host2 $HOST2 --user2 titi \
  3764. --passfile2 ../../var/pass/secret.titi \
  3765. --justlogin \
  3766. --debugimap1 --authmech1 NTLM --notrylogin
  3767. }
  3768. ll_authmech_NTLM_domain() {
  3769. # It fails since I don't have NTLM available
  3770. ! $CMD_PERL ./imapsync \
  3771. --host1 $HOST1 --user1 tata \
  3772. --passfile1 ../../var/pass/secret.tata \
  3773. --host2 $HOST2 --user2 titi \
  3774. --passfile2 ../../var/pass/secret.titi \
  3775. --justlogin \
  3776. --authmech1 NTLM --domain1 freshgrillfoods.com --debugimap1 --notrylogin
  3777. }
  3778. ll_authmech_NTLM_trylogin_ok() {
  3779. # It succeeds because --trylogin is set by default (for now).
  3780. $CMD_PERL ./imapsync \
  3781. --host1 $HOST1 --user1 tata \
  3782. --passfile1 ../../var/pass/secret.tata \
  3783. --host2 $HOST2 --user2 titi \
  3784. --passfile2 ../../var/pass/secret.titi \
  3785. --authmech1 NTLM --trylogin --justlogin
  3786. }
  3787. ll_authmech_NTLM_trylogin_fail() {
  3788. $CMD_PERL ./imapsync \
  3789. --host1 $HOST1 --user1 tata \
  3790. --passfile1 ../../var/pass/secret.tata \
  3791. --host2 $HOST2 --user2 titi \
  3792. --password2 'cacakiki' \
  3793. --authmech2 NTLM --trylogin --justlogin
  3794. test "$?" = "$EXIT_AUTHENTICATION_FAILURE_USER2"
  3795. }
  3796. ll_authmech_X_MASTERAUTH()
  3797. {
  3798. $CMD_PERL ./imapsync \
  3799. --host1 $HOST1 --user1 tata \
  3800. --passfile1 ../../var/pass/secret.tata \
  3801. --host2 $HOST2 --user2 titi \
  3802. --passfile2 ../../var/pass/secret.titi \
  3803. --authmech1 'X-MASTERAUTH' # --debugimap1
  3804. }
  3805. ll_authuser()
  3806. {
  3807. $CMD_PERL ./imapsync \
  3808. --host1 $HOST1 --user1 tata \
  3809. --passfile1 ../../var/pass/secret.tata \
  3810. --host2 $HOST2 --user2 titi \
  3811. --passfile2 ../../var/pass/secret.titi \
  3812. --justlogin --authuser2 titi --debugimap2
  3813. }
  3814. ll_proxyauth_missing_authuser()
  3815. {
  3816. $CMD_PERL ./imapsync \
  3817. --host1 $HOST1 --user1 tata \
  3818. --passfile1 ../../var/pass/secret.tata \
  3819. --host2 $HOST2 --user2 anything \
  3820. --passfile2 ../../var/pass/secret.titi \
  3821. --justlogin --proxyauth2
  3822. test "$?" = "$EX_USAGE"
  3823. }
  3824. ll_proxyauth_authuser()
  3825. {
  3826. $CMD_PERL ./imapsync \
  3827. --host1 $HOST1 --user1 tata \
  3828. --passfile1 ../../var/pass/secret.tata \
  3829. --host2 $HOST2 --user2 anything \
  3830. --passfile2 ../../var/pass/secret.titi \
  3831. --justlogin --proxyauth2 --authuser2 titi --debugimap2
  3832. test "$?" = "$EXIT_AUTHENTICATION_FAILURE_USER2"
  3833. }
  3834. ll_authmech_LOGIN() {
  3835. $CMD_PERL ./imapsync \
  3836. --host1 $HOST1 --user1 tata \
  3837. --passfile1 ../../var/pass/secret.tata \
  3838. --host2 $HOST2 --user2 titi \
  3839. --passfile2 ../../var/pass/secret.titi \
  3840. --justfoldersizes --nofoldersizes \
  3841. --authmech1 LOGIN --authmech2 LOGIN
  3842. }
  3843. ll_authmech_CRAMMD5() {
  3844. $CMD_PERL ./imapsync \
  3845. --host1 $HOST1 --user1 tata \
  3846. --passfile1 ../../var/pass/secret.tata \
  3847. --host2 $HOST2 --user2 titi \
  3848. --passfile2 ../../var/pass/secret.titi \
  3849. --justfoldersizes --nofoldersizes \
  3850. --authmech1 CRAM-MD5 --authmech2 CRAM-MD5
  3851. }
  3852. ll_delete1() {
  3853. # The initial state is a same message on both sides
  3854. ls -ld /home/vmail/tata/.oneemail3/cur/* || return 1
  3855. ls -ld /home/vmail/titi/.oneemail3/cur/* || return 1
  3856. echo 11111111111111111111111 tata titi
  3857. $CMD_PERL ./imapsync \
  3858. --host1 $HOST1 --user1 tata \
  3859. --passfile1 ../../var/pass/secret.tata \
  3860. --host2 $HOST2 --user2 titi \
  3861. --passfile2 ../../var/pass/secret.titi \
  3862. --folder INBOX.oneemail3 --delete1 --debugimap
  3863. #find /home/vmail/titi/.oneemail3/ || :
  3864. echo After first sync, tata has none, titi has one message
  3865. ! test -f /home/vmail/tata/.oneemail3/cur/* || return 1
  3866. test -f /home/vmail/titi/.oneemail3/cur/* || return 1
  3867. echo 222222222222222222222222 back: titi tata
  3868. $CMD_PERL ./imapsync \
  3869. --host1 $HOST1 --user1 titi \
  3870. --passfile1 ../../var/pass/secret.titi \
  3871. --host2 $HOST2 --user2 tata \
  3872. --passfile2 ../../var/pass/secret.tata \
  3873. --folder INBOX.oneemail3 --delete1 --delete2duplicates
  3874. echo After second sync reverse, tata has one, titi has no message
  3875. test -f /home/vmail/tata/.oneemail3/cur/* || return 1
  3876. ! test -f /home/vmail/titi/.oneemail3/cur/* || return 1
  3877. echo 3333333333333333333333333 initial state
  3878. $CMD_PERL ./imapsync \
  3879. --host1 $HOST1 --user1 tata \
  3880. --passfile1 ../../var/pass/secret.tata \
  3881. --host2 $HOST2 --user2 titi \
  3882. --passfile2 ../../var/pass/secret.titi \
  3883. --folder INBOX.oneemail3
  3884. #find /home/vmail/titi/.oneemail3/ || :
  3885. echo ll_delete1 finished
  3886. }
  3887. ll_delete1_twoemails()
  3888. {
  3889. # initial
  3890. ls /home/vmail/tata/.twoemails/cur/* || return 1
  3891. echo 11111111111111111111111 tata titi
  3892. $CMD_PERL ./imapsync \
  3893. --host1 $HOST1 --user1 tata \
  3894. --passfile1 ../../var/pass/secret.tata \
  3895. --host2 $HOST2 --user2 titi \
  3896. --passfile2 ../../var/pass/secret.titi \
  3897. --folder INBOX.twoemails --delete1
  3898. #find /home/vmail/titi/.twoemails/ || :
  3899. echo After first sync, tata has none, titi has two messages
  3900. ! ls /home/vmail/tata/.twoemails/cur/* || return 1
  3901. ls /home/vmail/titi/.twoemails/cur/* || return 1
  3902. echo 222222222222222222222222 back: titi tata
  3903. $CMD_PERL ./imapsync \
  3904. --host1 $HOST1 --user1 titi \
  3905. --passfile1 ../../var/pass/secret.titi \
  3906. --host2 $HOST2 --user2 tata \
  3907. --passfile2 ../../var/pass/secret.tata \
  3908. --folder INBOX.twoemails --delete1
  3909. ls /home/vmail/tata/.twoemails/cur/* || return 1
  3910. ! ls /home/vmail/titi/.twoemails/cur/* || return 1
  3911. echo 3333333333333333333333333 initial state
  3912. $CMD_PERL ./imapsync \
  3913. --host1 $HOST1 --user1 tata \
  3914. --passfile1 ../../var/pass/secret.tata \
  3915. --host2 $HOST2 --user2 titi \
  3916. --passfile2 ../../var/pass/secret.titi \
  3917. --folder INBOX.twoemails
  3918. #find /home/vmail/titi/.twoemails/ || :
  3919. echo ll_delete1_twoemails finished
  3920. }
  3921. ll_delete1_twoemails_dry()
  3922. {
  3923. # initial
  3924. ls /home/vmail/tata/.twoemails/cur/* || return 1
  3925. echo 11111111111111111111111 tata titi
  3926. $CMD_PERL ./imapsync \
  3927. --host1 $HOST1 --user1 tata \
  3928. --passfile1 ../../var/pass/secret.tata \
  3929. --host2 $HOST2 --user2 titi \
  3930. --passfile2 ../../var/pass/secret.titi \
  3931. --folder INBOX.twoemails --delete1 --dry --debug
  3932. }
  3933. ll_delete1_delete2() {
  3934. ! $CMD_PERL ./imapsync \
  3935. --host1 $HOST1 --user1 titi \
  3936. --passfile1 ../../var/pass/secret.titi \
  3937. --host2 $HOST2 --user2 tata \
  3938. --passfile2 ../../var/pass/secret.tata \
  3939. --delete1 --delete2
  3940. }
  3941. ll_delete2() {
  3942. can_send && sendtestmessage titi
  3943. $CMD_PERL ./imapsync \
  3944. --host1 $HOST1 --user1 tata \
  3945. --passfile1 ../../var/pass/secret.tata \
  3946. --host2 $HOST2 --user2 titi \
  3947. --passfile2 ../../var/pass/secret.titi \
  3948. --folder INBOX \
  3949. --delete2
  3950. }
  3951. ll_delete2_reverse() {
  3952. $CMD_PERL ./imapsync \
  3953. --host1 $HOST1 --user1 titi \
  3954. --passfile1 ../../var/pass/secret.titi \
  3955. --host2 $HOST2 --user2 tata \
  3956. --passfile2 ../../var/pass/secret.tata \
  3957. --folder INBOX \
  3958. --delete2
  3959. }
  3960. ll_delete1_reverse() {
  3961. ll_INBOX
  3962. $CMD_PERL ./imapsync \
  3963. --host1 $HOST1 --user1 titi \
  3964. --passfile1 ../../var/pass/secret.titi \
  3965. --host2 $HOST2 --user2 tata \
  3966. --passfile2 ../../var/pass/secret.tata \
  3967. --folder INBOX \
  3968. --delete1 --minage 10 --maxage 999 # --dry
  3969. }
  3970. ll_delete1_reverse_useuid() {
  3971. ll_INBOX
  3972. $CMD_PERL ./imapsync \
  3973. --host1 $HOST1 --user1 titi \
  3974. --passfile1 ../../var/pass/secret.titi \
  3975. --host2 $HOST2 --user2 tata \
  3976. --passfile2 ../../var/pass/secret.tata \
  3977. --folder INBOX \
  3978. --delete1 --minage 100 --maxage 600 \
  3979. --useuid
  3980. }
  3981. ll_delself() {
  3982. $CMD_PERL ./imapsync \
  3983. --host1 $HOST1 --user1 toto \
  3984. --passfile1 ../../var/pass/secret.toto \
  3985. --host2 $HOST2 --user2 delme \
  3986. --passfile2 ../../var/pass/secret.delme
  3987. $CMD_PERL ./imapsync \
  3988. --host1 $HOST1 --user1 delme \
  3989. --passfile1 ../../var/pass/secret.delme \
  3990. --host2 $HOST2 --user2 delme \
  3991. --passfile2 ../../var/pass/secret.delme \
  3992. --delete1 --noexpungeaftereach
  3993. $CMD_PERL ./imapsync \
  3994. --host1 $HOST1 --user1 delme \
  3995. --passfile1 ../../var/pass/secret.delme \
  3996. --host2 $HOST2 --user2 delme \
  3997. --passfile2 ../../var/pass/secret.delme \
  3998. --justfolders --delete2folders --regextrans2 "s/.*/INBOX/" --foldersizes
  3999. $CMD_PERL ./imapsync \
  4000. --host1 $HOST1 --user1 delme \
  4001. --passfile1 ../../var/pass/secret.delme \
  4002. --host2 $HOST2 --user2 delme \
  4003. --passfile2 ../../var/pass/secret.delme \
  4004. --justfoldersizes
  4005. }
  4006. ll_delete2_minage() {
  4007. can_send && sendtestmessage titi
  4008. $CMD_PERL ./imapsync \
  4009. --host1 $HOST1 --user1 tata \
  4010. --passfile1 ../../var/pass/secret.tata \
  4011. --host2 $HOST2 --user2 titi \
  4012. --passfile2 ../../var/pass/secret.titi \
  4013. --folder INBOX \
  4014. --delete2 --minage 1
  4015. }
  4016. ll_delete2_minage_useuid() {
  4017. can_send && sendtestmessage titi
  4018. $CMD_PERL ./imapsync \
  4019. --host1 $HOST1 --user1 tata \
  4020. --passfile1 ../../var/pass/secret.tata \
  4021. --host2 $HOST2 --user2 titi \
  4022. --passfile2 ../../var/pass/secret.titi \
  4023. --folder INBOX \
  4024. --delete2 --uidexpunge2 --minage 1 --useuid
  4025. }
  4026. ll_delete2_uidexpunge2_implicit() {
  4027. can_send && sendtestmessage titi
  4028. $CMD_PERL ./imapsync \
  4029. --host1 $HOST1 --user1 tata \
  4030. --passfile1 ../../var/pass/secret.tata \
  4031. --host2 $HOST2 --user2 titi \
  4032. --passfile2 ../../var/pass/secret.titi \
  4033. --folder INBOX \
  4034. --delete2 --useuid
  4035. }
  4036. ll_delete1duplicates() {
  4037. can_send && sendtestmessage titi thailah9eem4iHei
  4038. can_send && sendtestmessage tata thailah9eem4iHei
  4039. can_send && sendtestmessage tata thailah9eem4iHei
  4040. can_send && sendtestmessage tata thailah9eem4iHei
  4041. can_send && sendtestmessage tata thailah9eem4iHei
  4042. $CMD_PERL ./imapsync \
  4043. --host1 $HOST1 --user1 tata \
  4044. --passfile1 ../../var/pass/secret.tata \
  4045. --host2 $HOST2 --user2 titi \
  4046. --passfile2 ../../var/pass/secret.titi \
  4047. --folder INBOX --maxage 1 --useheader Subject # --delete2duplicates
  4048. }
  4049. ll_delete2duplicates() {
  4050. #can_send && sendtestmessage titi "test ll_delete2duplicates"
  4051. #can_send && sendtestmessage tata "test ll_delete2duplicates"
  4052. $CMD_PERL ./imapsync \
  4053. --host1 $HOST1 --user1 tata \
  4054. --passfile1 ../../var/pass/secret.tata \
  4055. --host2 $HOST2 --user2 titi \
  4056. --passfile2 ../../var/pass/secret.titi \
  4057. --folder INBOX \
  4058. --delete2duplicates --uidexpunge2 --useheader Subject --dry
  4059. }
  4060. ll_duplicates_across_folders() {
  4061. $CMD_PERL ./imapsync \
  4062. --host1 $HOST1 --user1 tata \
  4063. --passfile1 ../../var/pass/secret.tata \
  4064. --host2 $HOST2 --user2 titi \
  4065. --passfile2 ../../var/pass/secret.titi \
  4066. --folder INBOX.zz_1 \
  4067. --folder INBOX.zz_2 \
  4068. --folder INBOX.zz_3 \
  4069. --skipcrossduplicates --debugcrossduplicates
  4070. }
  4071. ll_delete2_dev() {
  4072. can_send && sendtestmessage titi
  4073. can_send && sendtestmessage
  4074. $CMD_PERL ./imapsync \
  4075. --host1 $HOST1 --user1 tata \
  4076. --passfile1 ../../var/pass/secret.tata \
  4077. --host2 $HOST2 --user2 titi \
  4078. --passfile2 ../../var/pass/secret.titi \
  4079. --include zz --include ZZ --regextrans2 's,.*,INBOX.z_merge,' \
  4080. --delete2
  4081. }
  4082. ll_maxmessagespersecond() {
  4083. ll_delete1_reverse
  4084. $CMD_PERL ./imapsync \
  4085. --host1 $HOST1 --user1 tata \
  4086. --passfile1 ../../var/pass/secret.tata \
  4087. --host2 $HOST2 --user2 titi \
  4088. --passfile2 ../../var/pass/secret.titi \
  4089. --folder INBOX \
  4090. --maxmessagespersecond 3.3
  4091. }
  4092. ll_maxbytespersecond() {
  4093. ll_delete1_reverse
  4094. $CMD_PERL ./imapsync \
  4095. --host1 $HOST1 --user1 tata \
  4096. --passfile1 ../../var/pass/secret.tata \
  4097. --host2 $HOST2 --user2 titi \
  4098. --passfile2 ../../var/pass/secret.titi \
  4099. --folder INBOX \
  4100. --maxbytespersecond 2000 --nofoldersizes
  4101. }
  4102. ll_maxbytespersecond_0() {
  4103. ll_delete1_reverse
  4104. $CMD_PERL ./imapsync \
  4105. --host1 $HOST1 --user1 tata \
  4106. --passfile1 ../../var/pass/secret.tata \
  4107. --host2 $HOST2 --user2 titi \
  4108. --passfile2 ../../var/pass/secret.titi \
  4109. --folder INBOX \
  4110. --maxbytespersecond 1 --nofoldersizes --maxsleep 0
  4111. }
  4112. ll_maxbytesafter() {
  4113. ll_delete1_reverse
  4114. $CMD_PERL ./imapsync \
  4115. --host1 $HOST1 --user1 tata \
  4116. --passfile1 ../../var/pass/secret.tata \
  4117. --host2 $HOST2 --user2 titi \
  4118. --passfile2 ../../var/pass/secret.titi \
  4119. --folder INBOX \
  4120. --maxbytespersecond 1000 --maxbytesafter 20000 --nofoldersizes
  4121. }
  4122. big2_bigmail_clean()
  4123. {
  4124. echo 'sudo sh -c "rm -v /home/vmail/big2/.bigmail/cur/*"'
  4125. sudo sh -c "rm -v /home/vmail/big2/.bigmail/cur/*"
  4126. }
  4127. ll_bigmail() {
  4128. time -p $CMD_PERL ./imapsync \
  4129. --host1 $HOST1 --user1 big1 \
  4130. --passfile1 ../../var/pass/secret.big1 \
  4131. --host2 $HOST2 --user2 big2 \
  4132. --passfile2 ../../var/pass/secret.big2 \
  4133. --folder INBOX.bigmail --debugmemory --nofoldersizes
  4134. echo 'sudo sh -c "rm -v /home/vmail/big2/.bigmail/cur/*"'
  4135. }
  4136. ll_bigmail_fastio() {
  4137. time -p $CMD_PERL ./imapsync \
  4138. --host1 $HOST1 --user1 big1 \
  4139. --passfile1 ../../var/pass/secret.big1 \
  4140. --host2 $HOST2 --user2 big2 \
  4141. --passfile2 ../../var/pass/secret.big2 \
  4142. --folder INBOX.bigmail --debugmemory --nofoldersizes --fastio1 --fastio2
  4143. echo 'sudo sh -c "rm -v /home/vmail/big2/.bigmail/cur/*"'
  4144. }
  4145. ll_bigmail_fastio_profile()
  4146. {
  4147. test "0" = "`id -u`" || {
  4148. echo Do instead
  4149. echo "sudo sh tests.sh ll_bigmail_fastio_profile"
  4150. return
  4151. }
  4152. big2_bigmail_clean
  4153. sync
  4154. echo 3 >/proc/sys/vm/drop_caches
  4155. free
  4156. ll_bigmail_fastio
  4157. echo End of ll_bigmail_fastio
  4158. big2_bigmail_clean
  4159. sync
  4160. echo 3 >/proc/sys/vm/drop_caches
  4161. free
  4162. ll_bigmail
  4163. echo End of ll_bigmail
  4164. free
  4165. }
  4166. # In mandatory_tests
  4167. memory_stress() {
  4168. free
  4169. $CMD_PERL ./imapsync --testsunit tests_memory_stress && free
  4170. }
  4171. ll_memory_consumption() {
  4172. $CMD_PERL ./imapsync \
  4173. --host1 $HOST1 --user1 big1 \
  4174. --passfile1 ../../var/pass/secret.big1 \
  4175. --host2 $HOST2 --user2 big2 \
  4176. --passfile2 ../../var/pass/secret.big2 \
  4177. --folder INBOX.bigmail2 \
  4178. --nofoldersizes
  4179. echo 'sudo sh -c "rm -v /home/vmail/big2/.bigmail2/cur/*"'
  4180. }
  4181. ll_syncduplicates() {
  4182. $CMD_PERL ./imapsync \
  4183. --host1 $HOST1 --user1 tata \
  4184. --passfile1 ../../var/pass/secret.tata \
  4185. --host2 $HOST1 --user2 titi \
  4186. --passfile2 ../../var/pass/secret.titi \
  4187. --folder INBOX.duplicates --debug --syncduplicates # --dry
  4188. }
  4189. ll_syncduplicates_delete2() {
  4190. $CMD_PERL ./imapsync \
  4191. --host1 $HOST1 --user1 tata \
  4192. --passfile1 ../../var/pass/secret.tata \
  4193. --host2 $HOST1 --user2 titi \
  4194. --passfile2 ../../var/pass/secret.titi \
  4195. --folder INBOX.duplicates --syncduplicates --delete2 # --dry
  4196. }
  4197. ll_syncduplicates_delete2_delete2duplicates() {
  4198. $CMD_PERL ./imapsync \
  4199. --host1 $HOST1 --user1 tata \
  4200. --passfile1 ../../var/pass/secret.tata \
  4201. --host2 $HOST1 --user2 titi \
  4202. --passfile2 ../../var/pass/secret.titi \
  4203. --folder INBOX.duplicates --syncduplicates --delete2 --delete2duplicates # --dry
  4204. }
  4205. ll_syncduplicates_noskipsize() {
  4206. $CMD_PERL ./imapsync \
  4207. --host1 $HOST1 --user1 tata \
  4208. --passfile1 ../../var/pass/secret.tata \
  4209. --host2 $HOST1 --user2 titi \
  4210. --passfile2 ../../var/pass/secret.titi \
  4211. --folder INBOX.duplicates --debug --syncduplicates --noskipsize # --dry
  4212. }
  4213. ll_syncduplicates_usecache() {
  4214. $CMD_PERL ./imapsync \
  4215. --host1 $HOST1 --user1 tata \
  4216. --passfile1 ../../var/pass/secret.tata \
  4217. --host2 $HOST1 --user2 titi \
  4218. --passfile2 ../../var/pass/secret.titi \
  4219. --folder INBOX.duplicates --debug --syncduplicates --usecache #--dry
  4220. }
  4221. ll_syncduplicates_reverse() {
  4222. $CMD_PERL ./imapsync \
  4223. --host1 $HOST1 --user1 titi \
  4224. --passfile1 ../../var/pass/secret.titi \
  4225. --host2 $HOST1 --user2 tata \
  4226. --passfile2 ../../var/pass/secret.tata \
  4227. --folder INBOX.duplicates --debug --syncduplicates # --dry
  4228. }
  4229. ll_remove_duplicates() {
  4230. $CMD_PERL ./imapsync \
  4231. --host1 $HOST1 --user1 tata \
  4232. --passfile1 ../../var/pass/secret.tata \
  4233. --host2 $HOST1 --user2 titi \
  4234. --passfile2 ../../var/pass/secret.titi \
  4235. --folder INBOX.duplicates --delete2duplicates # --dry
  4236. }
  4237. msw() {
  4238. if can_send; then
  4239. sendtestmessage toto
  4240. fi
  4241. scp imapsync test.bat test_exe.bat\
  4242. ../../var/pass/secret.toto \
  4243. ../../var/pass/secret.titi \
  4244. ../../var/pass/secret.tata \
  4245. Admin@c:'C:/msys/1.0/home/Admin/imapsync/'
  4246. ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/test.bat'
  4247. scp Admin@c:'C:/msys/1.0/home/Admin/imapsync/imapsync.exe' .
  4248. }
  4249. msw2() {
  4250. if can_send; then
  4251. sendtestmessage toto
  4252. fi
  4253. scp imapsync test_exe.bat\
  4254. ../../var/pass/secret.toto \
  4255. ../../var/pass/secret.titi \
  4256. ../../var/pass/secret.tata \
  4257. Admin@c:'C:/msys/1.0/home/Admin/imapsync/'
  4258. ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/test_exe.bat'
  4259. }
  4260. ll_change_characters_doublequotes() {
  4261. $CMD_PERL ./imapsync \
  4262. --host1 $HOST1 --user1 tata \
  4263. --passfile1 ../../var/pass/secret.tata \
  4264. --host2 $HOST2 --user2 titi \
  4265. --passfile2 ../../var/pass/secret.titi \
  4266. --justfolders --dry --nofoldersizes \
  4267. --regextrans2 's,\",_,g'
  4268. }
  4269. ll_change_characters_gmail() {
  4270. $CMD_PERL ./imapsync \
  4271. --host1 $HOST1 --user1 tata \
  4272. --passfile1 ../../var/pass/secret.tata \
  4273. --host2 $HOST2 --user2 titi \
  4274. --passfile2 ../../var/pass/secret.titi \
  4275. --folder "INBOX. f g\h\"i'j " --justfolders \
  4276. --regextrans2 "s/['\"\\\\]/_/g" --regextrans2 's,(/|^) +,$1,g' --regextrans2 's, +(/|$),$1,g'
  4277. }
  4278. ll_blanc_vs_hyphen_gmail() {
  4279. $CMD_PERL ./imapsync \
  4280. --host1 $HOST1 --user1 tata \
  4281. --passfile1 ../../var/pass/secret.tata \
  4282. --host2 $HOST2 --user2 titi \
  4283. --passfile2 ../../var/pass/secret.titi \
  4284. --folder "INBOX.A-B" --folder "INBOX.A B" --folder "INBOX.A.B" --justfolders
  4285. }
  4286. # Gmail tests
  4287. # A big mess!
  4288. xxxxx_gmail() {
  4289. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4290. --host1 $HOST2 \
  4291. --user1 tata \
  4292. --passfile1 ../../var/pass/secret.tata \
  4293. --host2 imap.gmail.com \
  4294. --ssl2 \
  4295. --user2 gilles.lamiral@gmail.com \
  4296. --passfile2 ../../var/pass/secret.gilles_gmail \
  4297. --nofoldersizes \
  4298. --regextrans2 's,(/|^) +,$1,g' --regextrans2 's, +(/|$),$1,g' \
  4299. --exclude 'INBOX.yop.YAP' \
  4300. --regextrans2 "s,^Messages envoy&AOk-s$,[Gmail]/Messages envoy&AOk-s," \
  4301. --regextrans2 "s,^Sent$,[Gmail]/Sent Mail," \
  4302. --folder 'INBOX.Messages envoy&AOk-s' \
  4303. --folder 'INBOX.Sent'
  4304. }
  4305. xxxxx_gmail_useuid() {
  4306. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4307. --host1 $HOST2 \
  4308. --user1 tata \
  4309. --passfile1 ../../var/pass/secret.tata \
  4310. --host2 imap.gmail.com \
  4311. --ssl2 \
  4312. --user2 gilles.lamiral@gmail.com \
  4313. --passfile2 ../../var/pass/secret.gilles_gmail \
  4314. --nofoldersizes \
  4315. --regextrans2 "s,^Sent$,[Gmail]/Sent Mail," \
  4316. --folder 'INBOX.Sent' --useuid --dry
  4317. }
  4318. xxxxx_gmail_02() {
  4319. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4320. --host1 $HOST2 \
  4321. --user1 tata \
  4322. --passfile1 ../../var/pass/secret.tata \
  4323. --host2 imap.gmail.com \
  4324. --ssl2 \
  4325. --user2 gilles.lamiral@gmail.com \
  4326. --passfile2 ../../var/pass/secret.gilles_gmail \
  4327. --nofoldersizes \
  4328. --regextrans2 's,(.*),SMS,'
  4329. }
  4330. xxxxx_gmail_03() {
  4331. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4332. --host1 $HOST2 \
  4333. --user1 tata \
  4334. --passfile1 ../../var/pass/secret.tata \
  4335. --host2 imap.gmail.com \
  4336. --ssl2 \
  4337. --user2 gilles.lamiral@gmail.com \
  4338. --passfile2 ../../var/pass/secret.gilles_gmail \
  4339. --nofoldersizes \
  4340. --folder INBOX.few_emails --debug --useheader Message-ID --delete2 --dry
  4341. }
  4342. xxxxx_gmail_03_Received() {
  4343. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4344. --host1 $HOST2 \
  4345. --user1 tata \
  4346. --passfile1 ../../var/pass/secret.tata \
  4347. --host2 imap.gmail.com \
  4348. --ssl2 \
  4349. --user2 gilles.lamiral@gmail.com \
  4350. --passfile2 ../../var/pass/secret.gilles_gmail \
  4351. --nofoldersizes \
  4352. --folder INBOX.few_emails --debug --useheader Received --delete2 --dry
  4353. }
  4354. xxxxx_gmail_04_Sent() {
  4355. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4356. --host1 $HOST2 \
  4357. --user1 tata \
  4358. --passfile1 ../../var/pass/secret.tata \
  4359. --host2 imap.gmail.com \
  4360. --ssl2 \
  4361. --user2 gilles.lamiral@gmail.com \
  4362. --passfile2 ../../var/pass/secret.gilles_gmail \
  4363. --folder INBOX.Sent \
  4364. --regextrans2 's{Sent}{[Gmail]/Messages envoy&AOk-s}' \
  4365. --debugflags
  4366. }
  4367. xxxxx_gmail_05_justfolders() {
  4368. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4369. --host1 $HOST2 \
  4370. --user1 tata \
  4371. --passfile1 ../../var/pass/secret.tata \
  4372. --host2 imap.gmail.com \
  4373. --ssl2 \
  4374. --user2 gilles.lamiral@gmail.com \
  4375. --passfile2 ../../var/pass/secret.gilles_gmail \
  4376. --justfolders --nofoldersizes \
  4377. --regextrans2 's,(/|^) +,$1,g' --regextrans2 's, +(/|$),$1,g' \
  4378. --regextrans2 "s/[\^]/_/g" --debug
  4379. }
  4380. xxxxx_gmail_05_justlogin() {
  4381. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4382. --host1 $HOST2 \
  4383. --user1 tata \
  4384. --passfile1 ../../var/pass/secret.tata \
  4385. --host2 imap.gmail.com \
  4386. --ssl2 \
  4387. --user2 gilles.lamiral@gmail.com \
  4388. --passfile2 ../../var/pass/secret.gilles_gmail \
  4389. --justlogin
  4390. }
  4391. xxxxx_gmail_05_justlogin_exe() {
  4392. ! ping -c1 imap.gmail.com || ./imapsync_elf_x86.bin \
  4393. --host1 $HOST2 \
  4394. --user1 tata \
  4395. --passfile1 ../../var/pass/secret.tata \
  4396. --host2 imap.gmail.com \
  4397. --ssl2 \
  4398. --user2 gilles.lamiral@gmail.com \
  4399. --passfile2 ../../var/pass/secret.gilles_gmail \
  4400. --justlogin
  4401. }
  4402. xxxxx_gmail_05_justlogin_SSLv3() {
  4403. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4404. --host1 $HOST2 \
  4405. --user1 tata \
  4406. --passfile1 ../../var/pass/secret.tata \
  4407. --host2 imap.gmail.com \
  4408. --ssl2 \
  4409. --user2 gilles.lamiral@gmail.com \
  4410. --passfile2 ../../var/pass/secret.gilles_gmail \
  4411. --justlogin --ssl2_SSL_version SSLv3 --justconnect
  4412. }
  4413. xxxxx_gmail_05_justlogin_SSLv2() {
  4414. ! ping -c1 imap.gmail.com || ! $CMD_PERL ./imapsync \
  4415. --host1 $HOST2 \
  4416. --user1 tata \
  4417. --passfile1 ../../var/pass/secret.tata \
  4418. --host2 imap.gmail.com \
  4419. --ssl2 \
  4420. --user2 gilles.lamiral@gmail.com \
  4421. --passfile2 ../../var/pass/secret.gilles_gmail \
  4422. --justlogin --ssl2_SSL_version SSLv2
  4423. }
  4424. xxxxx_gmail_05_justlogin_SSLv23() {
  4425. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4426. --host1 $HOST2 \
  4427. --user1 tata \
  4428. --passfile1 ../../var/pass/secret.tata \
  4429. --host2 imap.gmail.com \
  4430. --ssl2 \
  4431. --user2 gilles.lamiral@gmail.com \
  4432. --passfile2 ../../var/pass/secret.gilles_gmail \
  4433. --justlogin --ssl2_SSL_version SSLv23
  4434. }
  4435. xxxxx_gmail_trailing_blanks() {
  4436. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4437. --host1 $HOST2 \
  4438. --user1 tata \
  4439. --passfile1 ../../var/pass/secret.tata \
  4440. --host2 imap.gmail.com \
  4441. --ssl2 \
  4442. --user2 gilles.lamiral@gmail.com \
  4443. --passfile2 ../../var/pass/secret.gilles_gmail \
  4444. --nofoldersizes \
  4445. --justfolders \
  4446. --include "[ ]" \
  4447. --regextrans2 's,^ +| +$,,g' --regextrans2 's,/ +| +/,/,g'
  4448. }
  4449. xxxxx_gmail_trailing_blanks_gmail2() {
  4450. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4451. --host1 $HOST2 \
  4452. --user1 tata \
  4453. --passfile1 ../../var/pass/secret.tata \
  4454. --user2 gilles.lamiral@gmail.com \
  4455. --passfile2 ../../var/pass/secret.gilles_gmail \
  4456. --nofoldersizes \
  4457. --justfolders \
  4458. --include "[ ]" \
  4459. --gmail2 --dry
  4460. }
  4461. xxxxx_gmail_delete2folders() {
  4462. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4463. --host1 $HOST2 \
  4464. --user1 tata \
  4465. --passfile1 ../../var/pass/secret.tata \
  4466. --user2 gilles.lamiral@gmail.com \
  4467. --passfile2 ../../var/pass/secret.gilles_gmail \
  4468. --nofoldersizes \
  4469. --justfolders \
  4470. --include "[ ]" \
  4471. --gmail2 --delete2foldersonly "m, ," --delete2foldersbutnot 'm,Gmail,'
  4472. }
  4473. xxxxx_gmail_07_hierarchy() {
  4474. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4475. --host1 $HOST2 \
  4476. --user1 tata \
  4477. --passfile1 ../../var/pass/secret.tata \
  4478. --host2 imap.gmail.com \
  4479. --ssl2 \
  4480. --user2 gilles.lamiral@gmail.com \
  4481. --passfile2 ../../var/pass/secret.gilles_gmail \
  4482. --nofoldersizes \
  4483. --folder INBOX.yop.yup.yip.yap.yep --justfolders
  4484. }
  4485. xxxxx_gmail_07_subfolder() {
  4486. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4487. --host1 $HOST2 \
  4488. --user1 tata \
  4489. --passfile1 ../../var/pass/secret.tata \
  4490. --host2 imap.gmail.com \
  4491. --ssl2 \
  4492. --user2 gilles.lamiral@gmail.com \
  4493. --passfile2 ../../var/pass/secret.gilles_gmail \
  4494. --nofoldersizes \
  4495. --justfolders --subfolder2 BBB
  4496. }
  4497. xxxxx_gmail_09_via_stunnel() {
  4498. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4499. --host1 $HOST2 \
  4500. --user1 tata \
  4501. --passfile1 ../../var/pass/secret.tata \
  4502. --host2 localhost \
  4503. --port2 9993 \
  4504. --user2 gilles.lamiral@gmail.com \
  4505. --passfile2 ../../var/pass/secret.gilles_gmail \
  4506. --foldersizes \
  4507. --folder INBOX
  4508. }
  4509. gmail_xxxxx() {
  4510. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4511. --host1 imap.gmail.com \
  4512. --ssl1 \
  4513. --user1 gilles.lamiral@gmail.com \
  4514. --passfile1 ../../var/pass/secret.gilles_gmail \
  4515. --host2 $HOST2 \
  4516. --user2 tata \
  4517. --passfile2 ../../var/pass/secret.tata \
  4518. --nofoldersizes \
  4519. --dry --justfolders --exclude "\[Gmail\]/All Mail"
  4520. }
  4521. gmail() {
  4522. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4523. --host1 imap.gmail.com \
  4524. --ssl1 \
  4525. --user1 gilles.lamiral@gmail.com \
  4526. --passfile1 ../../var/pass/secret.gilles_gmail \
  4527. --host2 $HOST2 \
  4528. --user2 tata \
  4529. --passfile2 ../../var/pass/secret.tata \
  4530. --exclude Gmail --exclude "blanc\ $"
  4531. }
  4532. gmail_l_tata() {
  4533. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4534. --host1 imap.gmail.com \
  4535. --ssl1 \
  4536. --user1 gilles.lamiral@gmail.com \
  4537. --passfile1 ../../var/pass/secret.gilles_gmail \
  4538. --host2 $HOST2 \
  4539. --user2 tata \
  4540. --passfile2 ../../var/pass/secret.tata \
  4541. --folder INBOX
  4542. }
  4543. gmail_justfolders() {
  4544. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4545. --host1 imap.gmail.com \
  4546. --ssl1 \
  4547. --user1 gilles.lamiral@gmail.com \
  4548. --passfile1 ../../var/pass/secret.gilles_gmail \
  4549. --host2 $HOST2 \
  4550. --user2 tata \
  4551. --passfile2 ../../var/pass/secret.tata \
  4552. --justfolders --exclude Gmail --exclude "blanc\ $"
  4553. }
  4554. gmail_justfolders_remove_Gmail() {
  4555. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4556. --host1 imap.gmail.com \
  4557. --ssl1 \
  4558. --user1 gilles.lamiral@gmail.com \
  4559. --passfile1 ../../var/pass/secret.gilles_gmail \
  4560. --host2 $HOST2 \
  4561. --user2 tata \
  4562. --passfile2 ../../var/pass/secret.tata \
  4563. --regextrans2 "s,\[Gmail\].,," --dry --justfolders
  4564. }
  4565. gmail_via_stunnel_ks() {
  4566. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4567. --host1 ks.lamiral.info \
  4568. --port1 243 --nossl1 \
  4569. --user1 gilles.lamiral@gmail.com \
  4570. --passfile1 ../../var/pass/secret.gilles_gmail \
  4571. --host2 $HOST2 \
  4572. --user2 tata \
  4573. --passfile2 ../../var/pass/secret.tata \
  4574. --useheader 'Message-Id' \
  4575. --useheader="X-Gmail-Received" \
  4576. --debug --justfolders
  4577. }
  4578. easygmail_gmail1_gmail2() {
  4579. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4580. --gmail1 \
  4581. --user1 gilles.lamiral@gmail.com \
  4582. --passfile1 ../../var/pass/secret.gilles_gmail \
  4583. --gmail2 \
  4584. --user2 imapsync.gl@gmail.com \
  4585. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4586. --justfolders
  4587. }
  4588. easygmail_gmail2()
  4589. {
  4590. $CMD_PERL ./imapsync \
  4591. --user1 gilles.lamiral@gmail.com \
  4592. --passfile1 ../../var/pass/secret.gilles_gmail \
  4593. --host1 imap.gmail.com \
  4594. --gmail2 \
  4595. --user2 imapsync.gl@gmail.com \
  4596. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4597. --justfolders
  4598. }
  4599. gmail_gl0_justlogin()
  4600. {
  4601. $CMD_PERL ./imapsync \
  4602. --gmail1 --user1 imapsync.gl0@gmail.com --passfile1 ../../var/pass/secret.imapsync.gl0_gmail \
  4603. --gmail2 --user2 imapsync.gl0@gmail.com --passfile2 ../../var/pass/secret.imapsync.gl0_gmail \
  4604. --justlogin
  4605. }
  4606. gmail_gl0_justlogin_oauthdirect()
  4607. {
  4608. cd /home/gilles/public_html/imapsync/W/learn
  4609. pwd
  4610. . ./oauth2.memo
  4611. regenerate_access_token
  4612. access_token=`cat oauth2_access_token.txt`
  4613. echo "$access_token"
  4614. generate_oauth2_string_for_imap_from_access_token "$access_token"
  4615. oauth2_string=`cat oauth2_string_for_oauthdirect.txt`
  4616. echo oauth2_string="$oauth2_string"
  4617. cd -
  4618. pwd
  4619. echo "2oauth2_string=$oauth2_string"
  4620. $CMD_PERL ./imapsync \
  4621. --gmail1 --user1 imapsync.gl0@gmail.com --passfile1 ../../var/pass/secret.imapsync.gl0_gmail \
  4622. --gmail2 --user2 imapsync.gl0@gmail.com --passfile2 ../../var/pass/secret.imapsync.gl0_gmail \
  4623. --justlogin --oauthdirect1 "$oauth2_string" --oauthdirect2 "$oauth2_string" --debugimap --showpasswords
  4624. pwd
  4625. }
  4626. gmail_gl0_oauthdirect_failure_login_success()
  4627. {
  4628. oauth2_string="kaka"
  4629. echo "2oauth2_string=$oauth2_string"
  4630. $CMD_PERL ./imapsync \
  4631. --gmail1 --user1 imapsync.gl0@gmail.com --passfile1 ../../var/pass/secret.imapsync.gl0_gmail \
  4632. --gmail2 --user2 imapsync.gl0@gmail.com --passfile2 ../../var/pass/secret.imapsync.gl0_gmail \
  4633. --justlogin --oauthdirect1 "$oauth2_string" --oauthdirect2 "$oauth2_string" --debugimap --showpasswords
  4634. }
  4635. all_login_tests()
  4636. {
  4637. run_tests ll_authmech_PREAUTH \
  4638. ll_authmd5 \
  4639. ll_authmd51 \
  4640. ll_authmd52 \
  4641. ll_noauthmd5 \
  4642. gmail_gl0_justlogin \
  4643. gmail_gl0_justlogin_oauthdirect \
  4644. ll_ssl_justlogin \
  4645. ll_tls_justlogin \
  4646. ll_tls_justlogin_sslargs_failure_EXIT_TLS_FAILURE \
  4647. yahoo_xxxx_login \
  4648. yahoo_xxxx_login_tls \
  4649. yahoo_xxxx_login_tls \
  4650. ll_justlogin \
  4651. ll_justlogin_notls \
  4652. l_office365_SSL_verify_mode \
  4653. office365_justlogin_ssl1_ssl2 \
  4654. office365_justlogin_tls \
  4655. office365_justlogin_tls2_office365 \
  4656. office365_justlogin_ssl2_tls2_office365 \
  4657. ll_ask_password \
  4658. ll_env_password \
  4659. }
  4660. gmail_glX_all_justlogin()
  4661. {
  4662. error_list=""
  4663. for X in "" 0 1 2 3; do
  4664. $CMD_PERL ./imapsync \
  4665. --gmail1 --user1 imapsync.gl${X}@gmail.com --passfile1 ../../var/pass/secret.imapsync.gl${X}_gmail \
  4666. --gmail2 --user2 imapsync.gl${X}@gmail.com --passfile2 ../../var/pass/secret.imapsync.gl${X}_gmail \
  4667. --justlogin || { error_list="${error_list}[imapsync.gl${X}@gmail.com] " ; }
  4668. done
  4669. echo3 "error_list=$error_list"
  4670. test "X$error_list" = X;
  4671. }
  4672. gmail_glX_all_justfolderlist()
  4673. {
  4674. error_list=""
  4675. for X in "" 0 1 2 3; do
  4676. $CMD_PERL ./imapsync \
  4677. --gmail1 --user1 imapsync.gl${X}@gmail.com --passfile1 ../../var/pass/secret.imapsync.gl${X}_gmail \
  4678. --gmail2 --user2 imapsync.gl${X}@gmail.com --passfile2 ../../var/pass/secret.imapsync.gl${X}_gmail \
  4679. --no-modulesversion --justfolderlists --nocheckfoldersexist || { error_list="${error_list}[imapsync.gl${X}@gmail.com] " ; }
  4680. done
  4681. echo3 "error_list=$error_list"
  4682. test "X$error_list" = X;
  4683. }
  4684. gmail_gmail_slash_in_foldername()
  4685. {
  4686. ./imapsync --gmail1 --user1 imapsync.gl1@gmail.com --passfile1 ../../var/pass/secret.imapsync.gl1_gmail \
  4687. --gmail2 --user2 imapsync.gl2@gmail.com --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4688. --no-modulesversion --dry --justfolders
  4689. }
  4690. gmail_gmail()
  4691. {
  4692. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4693. --host1 imap.gmail.com \
  4694. --user1 gilles.lamiral@gmail.com \
  4695. --passfile1 ../../var/pass/secret.gilles_gmail \
  4696. --host2 imap.gmail.com \
  4697. --user2 imapsync.gl@gmail.com \
  4698. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4699. --justfolders --exclude Gmail --exclude "blanc\ $"
  4700. }
  4701. gmail_gmail_exclude()
  4702. {
  4703. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4704. --host1 imap.gmail.com \
  4705. --user1 gilles.lamiral@gmail.com \
  4706. --passfile1 ../../var/pass/secret.gilles_gmail \
  4707. --host2 imap.gmail.com \
  4708. --user2 imapsync.gl@gmail.com \
  4709. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4710. --justfolders --exclude "/Trash"
  4711. }
  4712. gmail_gmail_inet4() {
  4713. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4714. --host1 imap.gmail.com \
  4715. --user1 gilles.lamiral@gmail.com \
  4716. --passfile1 ../../var/pass/secret.gilles_gmail \
  4717. --host2 imap.gmail.com \
  4718. --user2 imapsync.gl@gmail.com \
  4719. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4720. --justlogin --inet4
  4721. }
  4722. gmail_gmail_ipv6() {
  4723. ! ping6 -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4724. --host1 2a00:1450:400c:c0a::6c \
  4725. --ssl1 \
  4726. --user1 gilles.lamiral@gmail.com \
  4727. --passfile1 ../../var/pass/secret.gilles_gmail \
  4728. --host2 wl-in-x6c.1e100.net. \
  4729. --ssl2 \
  4730. --user2 imapsync.gl@gmail.com \
  4731. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4732. --justlogin
  4733. }
  4734. gmail_gmail_automap() {
  4735. $CMD_PERL ./imapsync \
  4736. --host1 imap.gmail.com \
  4737. --ssl1 \
  4738. --user1 gilles.lamiral@gmail.com \
  4739. --passfile1 ../../var/pass/secret.gilles_gmail \
  4740. --host2 imap.gmail.com \
  4741. --ssl2 \
  4742. --user2 imapsync.gl@gmail.com \
  4743. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4744. --justfolders --dry --automap --justautomap --f1f2 Junk=Junk --f1f2 Trash=Cake
  4745. }
  4746. gmail_gmail_noautomap() {
  4747. $CMD_PERL ./imapsync \
  4748. --host1 imap.gmail.com \
  4749. --ssl1 \
  4750. --user1 gilles.lamiral@gmail.com \
  4751. --passfile1 ../../var/pass/secret.gilles_gmail \
  4752. --host2 imap.gmail.com \
  4753. --ssl2 \
  4754. --user2 imapsync.gl@gmail.com \
  4755. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4756. --justfolders --dry --noautomap
  4757. }
  4758. gmail_gmail_justconnect() {
  4759. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4760. --host1 imap.gmail.com \
  4761. --ssl1 \
  4762. --user1 gilles.lamiral@gmail.com \
  4763. --passfile1 ../../var/pass/secret.gilles_gmail \
  4764. --host2 imap.gmail.com \
  4765. --ssl2 \
  4766. --user2 imapsync.gl@gmail.com \
  4767. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4768. --justconnect --timeout 1
  4769. }
  4770. gmail_gmail_justlogin() {
  4771. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4772. --host1 imap.gmail.com \
  4773. --ssl1 \
  4774. --user1 gilles.lamiral@gmail.com \
  4775. --passfile1 ../../var/pass/secret.gilles_gmail \
  4776. --host2 imap.gmail.com \
  4777. --ssl2 \
  4778. --user2 imapsync.gl@gmail.com \
  4779. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4780. --justlogin --id --debugimap
  4781. }
  4782. gmail_gl_gl2_justfolders() {
  4783. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4784. --host1 imap.gmail.com \
  4785. --user1 imapsync.gl@gmail.com \
  4786. --passfile1 ../../var/pass/secret.imapsync.gl_gmail \
  4787. --host2 imap.gmail.com \
  4788. --user2 imapsync.gl2@gmail.com \
  4789. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4790. --justfolders --exclude Gmail --exclude "blanc\ $" --dry
  4791. }
  4792. gmail_gl_gl2() {
  4793. $CMD_PERL ./imapsync \
  4794. --host1 imap.gmail.com \
  4795. --user1 imapsync.gl@gmail.com \
  4796. --passfile1 ../../var/pass/secret.imapsync.gl_gmail \
  4797. --host2 imap.gmail.com \
  4798. --user2 imapsync.gl2@gmail.com \
  4799. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4800. --folder INBOX --dry
  4801. }
  4802. gmail_gl_gl2_SUB() {
  4803. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4804. --host1 imap.gmail.com \
  4805. --ssl1 \
  4806. --user1 imapsync.gl@gmail.com \
  4807. --passfile1 ../../var/pass/secret.imapsync.gl_gmail \
  4808. --host2 imap.gmail.com \
  4809. --ssl2 \
  4810. --user2 imapsync.gl2@gmail.com \
  4811. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4812. --justfolders --nofoldersizes --exclude Gmail --regextrans2 "s,(.*),SUB/\$1,"
  4813. }
  4814. gmail_gl2_gl2_selectable()
  4815. {
  4816. $CMD_PERL ./imapsync \
  4817. --host1 imap.gmail.com \
  4818. --user1 imapsync.gl2@gmail.com \
  4819. --passfile1 ../../var/pass/secret.imapsync.gl2_gmail \
  4820. --host2 imap.gmail.com \
  4821. --user2 imapsync.gl2@gmail.com \
  4822. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4823. --dry --justautomap
  4824. }
  4825. gmail_gl_gl2_create_folder_old() {
  4826. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4827. --gmail1 \
  4828. --user1 imapsync.gl@gmail.com \
  4829. --passfile1 ../../var/pass/secret.imapsync.gl_gmail \
  4830. --gmail2 \
  4831. --user2 imapsync.gl2@gmail.com \
  4832. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4833. --justfolders --exclude Gmail --exclude "blanc\ $" \
  4834. --create_folder_old --dry --nofoldersizes
  4835. }
  4836. gmail_gmail_search_NOT_HEADER_attachment()
  4837. {
  4838. $CMD_PERL ./imapsync \
  4839. --gmail1 \
  4840. --user1 imapsync.gl@gmail.com \
  4841. --passfile1 ../../var/pass/secret.imapsync.gl_gmail \
  4842. --gmail2 \
  4843. --user2 imapsync.gl2@gmail.com \
  4844. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4845. --search "NOT HEADER Content-Disposition attachment" \
  4846. --folder INBOX --dry
  4847. # Also works
  4848. # --search 'HEADER Content-Type multipart/mixed' \
  4849. # Does not work the OR
  4850. # --search 'OR HEADER "Content-Disposition attachment" HEADER "Content-Type multipart/mixed"' \
  4851. }
  4852. gmail_gmail_folderfirst() {
  4853. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4854. --host1 imap.gmail.com \
  4855. --ssl1 \
  4856. --user1 gilles.lamiral@gmail.com \
  4857. --passfile1 ../../var/pass/secret.gilles_gmail \
  4858. --host2 imap.gmail.com \
  4859. --ssl2 \
  4860. --user2 imapsync.gl@gmail.com \
  4861. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4862. --exclude "blanc\ $" --exclude Gmail \
  4863. --justfolders --folderfirst INBOX --folderfirst zz --folderlast "[Gmail]/All Mail" --debug
  4864. }
  4865. gmail_gmail_INBOX() {
  4866. $CMD_PERL ./imapsync \
  4867. --host1 imap.gmail.com \
  4868. --user1 gilles.lamiral@gmail.com \
  4869. --passfile1 ../../var/pass/secret.gilles_gmail \
  4870. --host2 imap.gmail.com \
  4871. --user2 imapsync.gl@gmail.com \
  4872. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4873. --folder INBOX --debugflags
  4874. #--dry # --debug --debugimap # --authmech1 LOGIN
  4875. }
  4876. gmail_gmail_3_delete() {
  4877. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4878. --host1 imap.gmail.com \
  4879. --ssl1 \
  4880. --user1 imapsync.gl@gmail.com \
  4881. --passfile1 ../../var/pass/secret.imapsync.gl_gmail \
  4882. --host2 imap.gmail.com \
  4883. --ssl2 \
  4884. --user2 gilles.lamiral@gmail.com \
  4885. --passfile2 ../../var/pass/secret.gilles_gmail \
  4886. --folder '[Gmail]/All Mail' --delete1
  4887. # '[Gmail]/All Mail' is not expunge by default!
  4888. }
  4889. gmail_gmail_4_tls() {
  4890. ! ping -c1 imap.gmail.com || ! $CMD_PERL ./imapsync \
  4891. --host1 imap.gmail.com \
  4892. --ssl1 \
  4893. --user1 gilles.lamiral@gmail.com \
  4894. --passfile1 ../../var/pass/secret.gilles_gmail \
  4895. --host2 imap.gmail.com \
  4896. --ssl2 --tls2 --port2 993 \
  4897. --user2 imapsync.gl@gmail.com \
  4898. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4899. --folder INBOX
  4900. #--dry # --debug --debugimap # --authmech1 LOGIN
  4901. }
  4902. gmail_gmail_5_exclude_only_Gmail() {
  4903. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4904. --host1 imap.gmail.com \
  4905. --ssl1 \
  4906. --user1 gilles.lamiral@gmail.com \
  4907. --passfile1 ../../var/pass/secret.gilles_gmail \
  4908. --host2 imap.gmail.com \
  4909. --ssl2 \
  4910. --user2 imapsync.gl@gmail.com \
  4911. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4912. --nofoldersizes --folderrec "[Gmail]" --exclude "\[Gmail\]$"
  4913. }
  4914. gmail_gmail_6_search() {
  4915. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4916. --gmail1 \
  4917. --user1 gilles.lamiral@gmail.com \
  4918. --passfile1 ../../var/pass/secret.gilles_gmail \
  4919. --gmail2 \
  4920. --user2 imapsync.gl@gmail.com \
  4921. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4922. --folder INBOX --search 'X-GM-RAW "has:attachment"'
  4923. }
  4924. gmail_gmail_7_search() {
  4925. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4926. --host1 imap.gmail.com \
  4927. --user1 gilles.lamiral@gmail.com \
  4928. --passfile1 ../../var/pass/secret.gilles_gmail \
  4929. --host2 imap.gmail.com \
  4930. --user2 imapsync.gl@gmail.com \
  4931. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4932. --folder "[Gmail]/All Mail" --search 'X-GM-RAW "Analysez lalala performances"'
  4933. }
  4934. gmail_gmail_8_search() {
  4935. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4936. --gmail1 \
  4937. --user1 gilles.lamiral@gmail.com \
  4938. --passfile1 ../../var/pass/secret.gilles_gmail \
  4939. --gmail2 \
  4940. --user2 imapsync.gl@gmail.com \
  4941. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4942. --folder Test --nofoldersizes --debugimap \
  4943. --search 'X-GM-RAW "label:Important label:Test"'
  4944. }
  4945. gmail_gmail_9_search_X_GM_LABELS() {
  4946. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4947. --gmail1 \
  4948. --user1 gilles.lamiral@gmail.com \
  4949. --passfile1 ../../var/pass/secret.gilles_gmail \
  4950. --gmail2 \
  4951. --user2 imapsync.gl@gmail.com \
  4952. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4953. --folder Test --nofoldersizes --debugimap \
  4954. --search 'X-GM-LABELS "Important"'
  4955. }
  4956. gmail_gmail_10_search_drafts() {
  4957. ! ping -c1 imap.gmail.com || $CMD_PERL ./imapsync \
  4958. --gmail1 \
  4959. --user1 gilles.lamiral@gmail.com \
  4960. --passfile1 ../../var/pass/secret.gilles_gmail \
  4961. --gmail2 \
  4962. --user2 imapsync.gl@gmail.com \
  4963. --passfile2 ../../var/pass/secret.imapsync.gl_gmail \
  4964. --nofoldersizes \
  4965. --folderfirst '[Gmail]/Drafts' --debuglabels --dry \
  4966. --folder Test --folder '[Gmail]/Drafts'
  4967. }
  4968. gmail_gl_gl2_sslargs()
  4969. {
  4970. $CMD_PERL ./imapsync \
  4971. --host1 imap.gmail.com \
  4972. --ssl1 \
  4973. --user1 imapsync.gl@gmail.com \
  4974. --passfile1 ../../var/pass/secret.imapsync.gl_gmail \
  4975. --host2 imap.gmail.com \
  4976. --ssl2 \
  4977. --user2 imapsync.gl2@gmail.com \
  4978. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  4979. --justlogin --sslargs1 SSL_version=SSLv3 --sslargs1 SSL_verify_mode=0
  4980. }
  4981. # imapsync.gl@gmail.com
  4982. # imapsync.gl0@gmail.com == Source only account for imapsync
  4983. # imapsync.gl1@gmail.com == Source account for imapsync.gl2@gmail.com with
  4984. # --subfolder2 "Archive/Bob"
  4985. # --subfolder2 "Archive/Zuz"
  4986. # Destination account from imapsync.gl3@gmail.com with
  4987. # --subfolder1 "Archive/Bob"
  4988. # imapsync.gl2@gmail.com == Destination account --subfolder2 "Archive/Bob" from imapsync.gl1@gmail.com
  4989. # --subfolder2 "Archive/Zuz" from imapsync.gl1@gmail.com
  4990. # imapsync.gl3@gmail.com ==
  4991. sendtestmessage_gl0()
  4992. {
  4993. sendtestmessage imapsync.gl0@gmail.com
  4994. }
  4995. sendtestmessage_gl1()
  4996. {
  4997. sendtestmessage imapsync.gl1@gmail.com
  4998. }
  4999. gmail_gl1_gl2_labels()
  5000. {
  5001. #sendtestmessage imapsync.gl1@gmail.com
  5002. $CMD_PERL ./imapsync \
  5003. --host1 imap.gmail.com \
  5004. --user1 imapsync.gl1@gmail.com \
  5005. --passfile1 ../../var/pass/secret.imapsync.gl1_gmail \
  5006. --host2 imap.gmail.com \
  5007. --user2 imapsync.gl2@gmail.com \
  5008. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  5009. --exclude "\[Gmail\]" \
  5010. --synclabels --resynclabels --debug --debuglabels # --dry
  5011. }
  5012. gmail_gl1_gl2_labels_subfolder2()
  5013. {
  5014. #sendtestmessage imapsync.gl1@gmail.com
  5015. # The backup
  5016. $CMD_PERL ./imapsync \
  5017. --host1 imap.gmail.com \
  5018. --user1 imapsync.gl1@gmail.com \
  5019. --passfile1 ../../var/pass/secret.imapsync.gl1_gmail \
  5020. --host2 imap.gmail.com \
  5021. --user2 imapsync.gl2@gmail.com \
  5022. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  5023. --synclabels --resynclabels --debuglabels --delete2\
  5024. --subfolder2 "Archive/Bob" --nofoldersizes --gmail1 --gmail2 --dry # --exclude "\[Gmail\]"
  5025. return
  5026. #sendtestmessage imapsync.gl1@gmail.com
  5027. $CMD_PERL ./imapsync \
  5028. --host1 imap.gmail.com \
  5029. --user1 imapsync.gl1@gmail.com \
  5030. --passfile1 ../../var/pass/secret.imapsync.gl1_gmail \
  5031. --host2 imap.gmail.com \
  5032. --user2 imapsync.gl2@gmail.com \
  5033. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  5034. --gmail1 --gmail2 --synclabels --resynclabels --delete2 --folder INBOX --subfolder2 "Archive/Zuz"
  5035. }
  5036. gmail_gl2_gl3_labels_after_a_subfolder2_from_host1()
  5037. {
  5038. # A second backup, standard this one (no --subfolder2)
  5039. $CMD_PERL ./imapsync \
  5040. --host1 imap.gmail.com \
  5041. --user1 imapsync.gl2@gmail.com \
  5042. --passfile1 ../../var/pass/secret.imapsync.gl2_gmail \
  5043. --host2 imap.gmail.com \
  5044. --user2 imapsync.gl3@gmail.com \
  5045. --passfile2 ../../var/pass/secret.imapsync.gl3_gmail \
  5046. --synclabels --resynclabels --folderrec "Archive/Bob" --gmail1 --gmail2 --dry
  5047. }
  5048. gmail_gl3_gl1_labels_subfolder1()
  5049. {
  5050. # The restoration process
  5051. $CMD_PERL ./imapsync \
  5052. --host1 imap.gmail.com \
  5053. --user1 imapsync.gl3@gmail.com \
  5054. --passfile1 ../../var/pass/secret.imapsync.gl3_gmail \
  5055. --host2 imap.gmail.com \
  5056. --user2 imapsync.gl1@gmail.com \
  5057. --passfile2 ../../var/pass/secret.imapsync.gl1_gmail \
  5058. --subfolder1 "Archive/Bob" --debuglabels --resynclabels --nofoldersizes --justfolders #--dry
  5059. }
  5060. gmail_deuscustoms()
  5061. {
  5062. $CMD_PERL ./imapsync \
  5063. --host1 imap.gmail.com --user1 "test1@deuscustoms.com" --passfile1 '../../var/pass/test1@deuscustoms.com' \
  5064. --host2 imap.gmail.com --user2 "test2@deuscustoms.com" --passfile2 '../../var/pass/test2@deuscustoms.com' \
  5065. --subfolder2 "Archived accounts/Test User 1" \
  5066. --exclude "\[Gmail\]" --folderlast INBOX \
  5067. --debuglabels --resynclabels --synclabels --nofoldersizes #--dry
  5068. }
  5069. gmail_gl1_gl2_appendlimit()
  5070. {
  5071. #sendtestmessage imapsync.gl1@gmail.com
  5072. $CMD_PERL ./imapsync \
  5073. --host1 imap.gmail.com \
  5074. --user1 imapsync.gl1@gmail.com \
  5075. --passfile1 ../../var/pass/secret.imapsync.gl1_gmail \
  5076. --host2 imap.gmail.com \
  5077. --user2 imapsync.gl2@gmail.com \
  5078. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  5079. --gmail1 --gmail2 --nofoldersizes --justlogin
  5080. }
  5081. gmail_gl1_gl2_maxsize_over_appendlimit()
  5082. {
  5083. #sendtestmessage imapsync.gl1@gmail.com
  5084. $CMD_PERL ./imapsync \
  5085. --host1 imap.gmail.com \
  5086. --user1 imapsync.gl1@gmail.com \
  5087. --passfile1 ../../var/pass/secret.imapsync.gl1_gmail \
  5088. --host2 imap.gmail.com \
  5089. --user2 imapsync.gl2@gmail.com \
  5090. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  5091. --gmail1 --gmail2 --nofoldersizes \
  5092. --justlogin --maxsize 999_999_999_999
  5093. }
  5094. gmail_gl2_gl2_move_All_Mail_Trash()
  5095. {
  5096. #sendtestmessage imapsync.gl1@gmail.com
  5097. $CMD_PERL ./imapsync \
  5098. --user1 imapsync.gl2@gmail.com \
  5099. --passfile1 ../../var/pass/secret.imapsync.gl2_gmail \
  5100. --user2 imapsync.gl2@gmail.com \
  5101. --passfile2 ../../var/pass/secret.imapsync.gl2_gmail \
  5102. --gmail1 --gmail2 \
  5103. --folder '[Gmail]/Tous les messages' \
  5104. --f1f2 '[Gmail]/Tous les messages=[Gmail]/Corbeille'
  5105. }
  5106. yahoo_xxxx_login()
  5107. {
  5108. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5109. --host1 imap.mail.yahoo.com \
  5110. --user1 glamiral \
  5111. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5112. --host2 $HOST2 \
  5113. --user2 titi \
  5114. --passfile2 ../../var/pass/secret.titi \
  5115. --justlogin
  5116. }
  5117. yahoo_xxxx_login_tls() {
  5118. # tls1 no longer works on Yahoo
  5119. ! ping -c1 imap.mail.yahoo.com || ! $CMD_PERL ./imapsync \
  5120. --host1 imap.mail.yahoo.com \
  5121. --tls1 --timeout1 5 \
  5122. --user1 glamiral \
  5123. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5124. --host2 $HOST2 \
  5125. --user2 titi \
  5126. --passfile2 ../../var/pass/secret.titi \
  5127. --justlogin
  5128. }
  5129. yahoo_xxxx() {
  5130. # Yahoo works only with ssl (november 2011)
  5131. # Could do plain port 143 before
  5132. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5133. --host1 imap.mail.yahoo.com \
  5134. --user1 glamiral \
  5135. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5136. --host2 $HOST2 \
  5137. --user2 titi \
  5138. --passfile2 ../../var/pass/secret.titi \
  5139. --addheader --exclude Archive
  5140. }
  5141. yahoo_fail_UNAVAILABLE() {
  5142. # Those are messages from yahoo:
  5143. # Err 1/11: - msg Archive/470002 {0} S[12903] F[$NotJunk] I[25-Oct-2016 00:19:28 +0000] could not be fetched: 29 NO [UNAVAILABLE] UID FETCH Server error while fetching messages
  5144. # Update 2018/5/5: it now works well on those messages
  5145. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5146. --host1 imap.mail.yahoo.com \
  5147. --user1 glamiral \
  5148. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5149. --host2 $HOST2 \
  5150. --user2 titi \
  5151. --passfile2 ../../var/pass/secret.titi \
  5152. --addheader --folder Archive
  5153. }
  5154. yahoo_search_SENTBEFORE()
  5155. {
  5156. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5157. --host1 imap.mail.yahoo.com \
  5158. --user1 glamiral \
  5159. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5160. --host2 $HOST2 \
  5161. --user2 titi \
  5162. --passfile2 ../../var/pass/secret.titi \
  5163. --search "SENTBEFORE 1-Jan-2019"
  5164. }
  5165. yahoo_search_SENTAFTER()
  5166. {
  5167. # SENTAFTER is plain wrong, so it should fail!
  5168. ! ping -c1 imap.mail.yahoo.com || ! $CMD_PERL ./imapsync \
  5169. --host1 imap.mail.yahoo.com \
  5170. --user1 glamiral \
  5171. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5172. --host2 $HOST2 \
  5173. --user2 titi \
  5174. --passfile2 ../../var/pass/secret.titi \
  5175. --search "SENTAFTER 1-Jan-2019" --folder Inbox --dry --debugimap1
  5176. }
  5177. yahoo_search_SENTSINCE()
  5178. {
  5179. # SENTAFTER is wrong, it should fail!
  5180. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5181. --host1 imap.mail.yahoo.com \
  5182. --user1 glamiral \
  5183. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5184. --host2 $HOST2 \
  5185. --user2 titi \
  5186. --passfile2 ../../var/pass/secret.titi \
  5187. --search "SENTSINCE 1-Jan-2019" --folder Inbox --dry --debugimap1
  5188. }
  5189. yahoo_search_ALL_Inbox()
  5190. {
  5191. # SENTAFTER is wrong, it should fail!
  5192. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5193. --host1 imap.mail.yahoo.com \
  5194. --user1 glamiral \
  5195. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5196. --host2 $HOST2 \
  5197. --user2 titi \
  5198. --passfile2 ../../var/pass/secret.titi \
  5199. --search "ALL" --folder Inbox --dry
  5200. }
  5201. yahoo_yahoo_Inbox()
  5202. {
  5203. # SENTAFTER is wrong, it should fail!
  5204. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5205. --host1 imap.mail.yahoo.com \
  5206. --user1 glamiral \
  5207. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5208. --host2 imap.mail.yahoo.com \
  5209. --user2 glamiral \
  5210. --passfile2 ../../var/pass/secret.gilles_yahoo \
  5211. --folder Inbox --dry --debugimap1
  5212. }
  5213. yahoo_yahoo_search_ALL_Inbox()
  5214. {
  5215. # SENTAFTER is wrong, it should fail!
  5216. ! ping -c1 imap.mail.yahoo.com || $CMD_PERL ./imapsync \
  5217. --host1 imap.mail.yahoo.com \
  5218. --user1 glamiral \
  5219. --passfile1 ../../var/pass/secret.gilles_yahoo \
  5220. --host2 imap.mail.yahoo.com \
  5221. --user2 glamiral \
  5222. --passfile2 ../../var/pass/secret.gilles_yahoo \
  5223. --folder Inbox --dry --debugimap1 --search "ALL"
  5224. }
  5225. yahoo_all() {
  5226. yahoo_xxxx_login_tls || return 1
  5227. yahoo_xxxx_login || return 1
  5228. yahoo_xxxx || return 1
  5229. yahoo_fail_UNAVAILABLE || return 1
  5230. yahoo_search_SENTSINCE || return 1
  5231. yahoo_search_ALL_Inbox || return 1
  5232. yahoo_yahoo_Inbox || return 1
  5233. yahoo_search_SENTBEFORE || return 1
  5234. }
  5235. archiveopteryx_1() {
  5236. if can_send; then
  5237. #echo3 Here is plume
  5238. sendtestmessage je@lupus.aox.org
  5239. else
  5240. :
  5241. fi
  5242. $CMD_PERL ./imapsync \
  5243. --host1 lupus.aox.org --user1 je \
  5244. --passfile1 ../../var/pass/secret.aox_je \
  5245. --host2 lupus.aox.org --user2 je \
  5246. --passfile2 ../../var/pass/secret.aox_je \
  5247. --folder INBOX --regextrans2 's/INBOX/copy/'
  5248. }
  5249. dkimap_1() {
  5250. $CMD_PERL ./imapsync \
  5251. --host1 Mail.fourfrontsales.com --user1 dktest \
  5252. --passfile1 ../../var/pass/secret.dktest \
  5253. --host2 $HOST2 --user2 titi \
  5254. --passfile2 ../../var/pass/secret.titi \
  5255. --folder INBOX/dkimap --regextrans2 's/INBOX.INBOX./INBOX./' \
  5256. --foldersize --nouid1
  5257. }
  5258. ll_justlogin() {
  5259. $CMD_PERL ./imapsync \
  5260. --host1 $HOST1 --user1 tata \
  5261. --passfile1 ../../var/pass/secret.tata \
  5262. --host2 $HOST2 --user2 titi \
  5263. --passfile2 ../../var/pass/secret.titi \
  5264. --justlogin
  5265. }
  5266. ll_justlogin_notls() {
  5267. $CMD_PERL ./imapsync \
  5268. --host1 $HOST1 --user1 tata \
  5269. --passfile1 ../../var/pass/secret.tata \
  5270. --host2 $HOST2 --user2 titi \
  5271. --passfile2 ../../var/pass/secret.titi \
  5272. --justlogin --notls1 --notls2
  5273. }
  5274. ll_justlogin_nocompress() {
  5275. $CMD_PERL ./imapsync \
  5276. --host1 $HOST1 --user1 tata \
  5277. --passfile1 ../../var/pass/secret.tata \
  5278. --host2 $HOST2 --user2 titi \
  5279. --passfile2 ../../var/pass/secret.titi \
  5280. --justlogin --nocompress2
  5281. }
  5282. ll_justlogin_backslash_char() {
  5283. # Look in the file ../../var/pass/secret.tptp to see
  5284. # strange \ character behavior
  5285. $CMD_PERL ./imapsync \
  5286. --host1 $HOST1 --user1 tata \
  5287. --passfile1 ../../var/pass/secret.tata \
  5288. --host2 $HOST2 --user2 tptp@est.belle \
  5289. --passfile2 ../../var/pass/secret.tptp \
  5290. --justlogin
  5291. }
  5292. ll_justlogin_dollar_char() {
  5293. $CMD_PERL ./imapsync \
  5294. --host1 $HOST1 --user1 tata \
  5295. --passfile1 ../../var/pass/secret.tata \
  5296. --host2 $HOST2 --user2 dollar \
  5297. --passfile2 ../../var/pass/secret.dollar \
  5298. --justlogin --showpasswords --debugimap2
  5299. }
  5300. ll_justlogin_equal_char() {
  5301. $CMD_PERL ./imapsync \
  5302. --host1 $HOST1 --user1 tata \
  5303. --passfile1 ../../var/pass/secret.tata \
  5304. --host2 $HOST2 --user2 equal \
  5305. --passfile2 ../../var/pass/secret.equal \
  5306. --justlogin --debugimap2
  5307. }
  5308. ll_usecache()
  5309. {
  5310. if can_send; then
  5311. sendtestmessage
  5312. fi
  5313. $CMD_PERL ./imapsync \
  5314. --host1 $HOST1 --user1 tata \
  5315. --passfile1 ../../var/pass/secret.tata \
  5316. --host2 $HOST2 --user2 titi \
  5317. --passfile2 ../../var/pass/secret.titi \
  5318. --usecache --nofoldersizes \
  5319. --folder INBOX
  5320. }
  5321. ll_usecache_INBOX() {
  5322. if can_send; then
  5323. sendtestmessage
  5324. else
  5325. :
  5326. fi
  5327. $CMD_PERL ./imapsync \
  5328. --host1 $HOST1 --user1 tata \
  5329. --passfile1 ../../var/pass/secret.tata \
  5330. --host2 $HOST2 --user2 titi \
  5331. --passfile2 ../../var/pass/secret.titi \
  5332. --usecache \
  5333. --folder INBOX
  5334. }
  5335. ll_usecache_all()
  5336. {
  5337. $CMD_PERL ./imapsync \
  5338. --host1 $HOST1 --user1 tata \
  5339. --passfile1 ../../var/pass/secret.tata \
  5340. --host2 $HOST2 --user2 titi \
  5341. --passfile2 ../../var/pass/secret.titi \
  5342. --usecache --nofoldersizes
  5343. }
  5344. ll_usecache_bracket() {
  5345. $CMD_PERL ./imapsync \
  5346. --host1 $HOST1 --user1 tata \
  5347. --passfile1 ../../var/pass/secret.tata \
  5348. --host2 $HOST2 --user2 titi \
  5349. --passfile2 ../../var/pass/secret.titi \
  5350. --usecache --nofoldersizes --debugcache --folder "INBOX.[bracket]"
  5351. }
  5352. # In mandatory_tests
  5353. ll_nousecache() {
  5354. if can_send; then
  5355. sendtestmessage
  5356. else
  5357. :
  5358. fi
  5359. $CMD_PERL ./imapsync \
  5360. --host1 $HOST1 --user1 tata \
  5361. --passfile1 ../../var/pass/secret.tata \
  5362. --host2 $HOST2 --user2 titi \
  5363. --passfile2 ../../var/pass/secret.titi \
  5364. --nousecache --nofoldersizes \
  5365. --folder INBOX
  5366. }
  5367. ll_usecache_noheader() {
  5368. if can_send; then
  5369. sendtestmessage
  5370. else
  5371. :
  5372. fi
  5373. $CMD_PERL ./imapsync \
  5374. --host1 $HOST1 --user1 tata \
  5375. --passfile1 ../../var/pass/secret.tata \
  5376. --host2 $HOST2 --user2 titi \
  5377. --passfile2 ../../var/pass/secret.titi \
  5378. --usecache \
  5379. --folder INBOX --useheader ''
  5380. }
  5381. ll_usecache_debugcache() {
  5382. if can_send; then
  5383. sendtestmessage
  5384. else
  5385. :
  5386. fi
  5387. $CMD_PERL ./imapsync \
  5388. --host1 $HOST1 --user1 tata \
  5389. --passfile1 ../../var/pass/secret.tata \
  5390. --host2 $HOST2 --user2 titi \
  5391. --passfile2 ../../var/pass/secret.titi \
  5392. --usecache --nofoldersizes \
  5393. --folder INBOX --useheader '' --debugcache
  5394. }
  5395. ll_usecache_debugcache_useuid() {
  5396. if can_send; then
  5397. sendtestmessage
  5398. else
  5399. :
  5400. fi
  5401. $CMD_PERL ./imapsync \
  5402. --host1 $HOST1 --user1 tata \
  5403. --passfile1 ../../var/pass/secret.tata \
  5404. --host2 $HOST2 --user2 titi \
  5405. --passfile2 ../../var/pass/secret.titi \
  5406. --usecache --nofoldersizes \
  5407. --folder INBOX --useheader '' --debugcache --useuid
  5408. }
  5409. ll_useuid_INBOX()
  5410. {
  5411. if can_send; then
  5412. sendtestmessage
  5413. else
  5414. :
  5415. fi
  5416. $CMD_PERL ./imapsync \
  5417. --host1 $HOST1 --user1 tata \
  5418. --passfile1 ../../var/pass/secret.tata \
  5419. --host2 $HOST2 --user2 titi \
  5420. --passfile2 ../../var/pass/secret.titi \
  5421. --folder INBOX \
  5422. --delete2 \
  5423. --useuid
  5424. }
  5425. # In mandatory_tests
  5426. ll_useuid()
  5427. {
  5428. $CMD_PERL ./imapsync \
  5429. --host1 $HOST1 --user1 tata \
  5430. --passfile1 ../../var/pass/secret.tata \
  5431. --host2 $HOST2 --user2 titi \
  5432. --passfile2 ../../var/pass/secret.titi \
  5433. --folder INBOX.useuid \
  5434. --delete2 \
  5435. --useuid
  5436. }
  5437. ll_useuid_all()
  5438. {
  5439. $CMD_PERL ./imapsync \
  5440. --host1 $HOST1 --user1 tata \
  5441. --passfile1 ../../var/pass/secret.tata \
  5442. --host2 $HOST2 --user2 titi \
  5443. --passfile2 ../../var/pass/secret.titi \
  5444. --delete2 --useuid --nofoldersizes
  5445. }
  5446. # In mandatory_tests
  5447. ll_useuid_nousecache()
  5448. {
  5449. $CMD_PERL ./imapsync \
  5450. --host1 $HOST1 --user1 tata \
  5451. --passfile1 ../../var/pass/secret.tata \
  5452. --host2 $HOST2 --user2 titi \
  5453. --passfile2 ../../var/pass/secret.titi \
  5454. --folder INBOX.useuid \
  5455. --useuid --nousecache --debugcache
  5456. echo 'rm /home/vmail/titi/.yop.yap/cur/*'
  5457. }
  5458. ll_fastio()
  5459. {
  5460. time -p $CMD_PERL ./imapsync \
  5461. --host1 $HOST1 --user1 tata \
  5462. --passfile1 ../../var/pass/secret.tata \
  5463. --host2 $HOST2 --user2 titi \
  5464. --passfile2 ../../var/pass/secret.titi \
  5465. --folder INBOX --fastio1 --fastio2
  5466. }
  5467. ll_nofastio()
  5468. {
  5469. time -p $CMD_PERL ./imapsync \
  5470. --host1 $HOST1 --user1 tata \
  5471. --passfile1 ../../var/pass/secret.tata \
  5472. --host2 $HOST2 --user2 titi \
  5473. --passfile2 ../../var/pass/secret.titi \
  5474. --folder INBOX --nofastio1 --nofastio2
  5475. }
  5476. l_office365()
  5477. {
  5478. $CMD_PERL ./imapsync \
  5479. --host1 $HOST1 --user1 tata \
  5480. --passfile1 ../../var/pass/secret.tata \
  5481. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5482. --passfile2 ../../var/pass/secret.outlook.com \
  5483. --folder INBOX --tmpdir /var/tmp --usecache --regextrans2 's/INBOX/tata/' --delete2
  5484. }
  5485. l_office365_deleted_flag()
  5486. {
  5487. $CMD_PERL ./imapsync \
  5488. --host1 $HOST1 --user1 tata \
  5489. --passfile1 ../../var/pass/secret.tata \
  5490. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5491. --passfile2 ../../var/pass/secret.outlook.com \
  5492. --folder INBOX.flags --tmpdir /var/tmp --regextrans2 's/INBOX/tata/' --debugflags
  5493. }
  5494. l_office365_flagged_flag()
  5495. {
  5496. $CMD_PERL ./imapsync \
  5497. --host1 $HOST1 --user1 tata \
  5498. --passfile1 ../../var/pass/secret.tata \
  5499. --office2 --user2 gilles.lamiral@outlook.com \
  5500. --passfile2 ../../var/pass/secret.outlook.com \
  5501. --folder INBOX.flags --tmpdir /var/tmp --regextrans2 's/INBOX/tata/' --debugflags
  5502. }
  5503. l_office365_noregexmess()
  5504. {
  5505. $CMD_PERL ./imapsync \
  5506. --host1 $HOST1 --user1 tata \
  5507. --passfile1 ../../var/pass/secret.tata \
  5508. --office2 --user2 gilles.lamiral@outlook.com \
  5509. --passfile2 ../../var/pass/secret.outlook.com \
  5510. --justbanner --noregexmess
  5511. }
  5512. l_exchange2_flagged_flag()
  5513. {
  5514. $CMD_PERL ./imapsync \
  5515. --host1 $HOST1 --user1 tata \
  5516. --passfile1 ../../var/pass/secret.tata \
  5517. --host2 outlook.office365.com \
  5518. --exchange2 --user2 gilles.lamiral@outlook.com \
  5519. --passfile2 ../../var/pass/secret.outlook.com \
  5520. --regextrans2 's/INBOX/tata/' --nofoldersizes \
  5521. --folder INBOX.flags --debugflags
  5522. }
  5523. l_exchange2_flagged_noregexflag()
  5524. {
  5525. $CMD_PERL ./imapsync \
  5526. --host1 $HOST1 --user1 tata \
  5527. --passfile1 ../../var/pass/secret.tata \
  5528. --host2 outlook.office365.com \
  5529. --exchange2 --user2 gilles.lamiral@outlook.com \
  5530. --passfile2 ../../var/pass/secret.outlook.com \
  5531. --regextrans2 's/INBOX/tata/' --nofoldersizes \
  5532. --folder INBOX.flags --debugflags --noregexflag
  5533. }
  5534. l_exchange2_noregexmess_noregexflag()
  5535. {
  5536. $CMD_PERL ./imapsync \
  5537. --host1 $HOST1 --user1 tata \
  5538. --passfile1 ../../var/pass/secret.tata \
  5539. --host2 outlook.office365.com \
  5540. --exchange2 --user2 gilles.lamiral@outlook.com \
  5541. --passfile2 ../../var/pass/secret.outlook.com \
  5542. --justbanner --noregexmess --noregexflag
  5543. }
  5544. l_office365_SSL_verify_mode()
  5545. {
  5546. $CMD_PERL ./imapsync \
  5547. --host1 $HOST1 --user1 tata \
  5548. --passfile1 ../../var/pass/secret.tata \
  5549. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5550. --passfile2 ../../var/pass/secret.outlook.com \
  5551. --justlogin --sslargs2 SSL_verify_mode=1
  5552. }
  5553. office1_office2()
  5554. {
  5555. $CMD_PERL ./imapsync \
  5556. --office1 \
  5557. --user1 gilles.lamiral@outlook.com \
  5558. --passfile1 ../../var/pass/secret.outlook.com \
  5559. --office2 \
  5560. --user2 gilles.lamiral@outlook.com \
  5561. --passfile2 ../../var/pass/secret.outlook.com \
  5562. --justfolders
  5563. }
  5564. office1_office2_sentbefore()
  5565. {
  5566. $CMD_PERL ./imapsync \
  5567. --office1 \
  5568. --user1 gilles.lamiral@outlook.com \
  5569. --passfile1 ../../var/pass/secret.outlook.com \
  5570. --office2 \
  5571. --user2 gilles.lamiral@outlook.com \
  5572. --passfile2 ../../var/pass/secret.outlook.com \
  5573. --folder Sent --search "SENTBEFORE 31-Dec-2013" --debugimap
  5574. }
  5575. office1_office2_noexclude()
  5576. {
  5577. $CMD_PERL ./imapsync \
  5578. --office1 \
  5579. --user1 gilles.lamiral@outlook.com \
  5580. --passfile1 ../../var/pass/secret.outlook.com \
  5581. --office2 \
  5582. --user2 gilles.lamiral@outlook.com \
  5583. --passfile2 ../../var/pass/secret.outlook.com \
  5584. --justfolders --noexclude
  5585. }
  5586. office365_justconnect_tls_SSL_verify_mode_1()
  5587. {
  5588. $CMD_PERL ./imapsync \
  5589. --host1 imap-mail.outlook.com --ssl1 --user1 gilles.lamiral@outlook.com \
  5590. --passfile1 ../../var/pass/secret.outlook.com \
  5591. --host2 outlook.office365.com --tls2 --user2 gilles.lamiral@outlook.com \
  5592. --passfile2 ../../var/pass/secret.outlook.com \
  5593. --justconnect --sslargs2 SSL_verify_mode=1
  5594. }
  5595. office365_justlogin_ssl1_ssl2()
  5596. {
  5597. $CMD_PERL ./imapsync \
  5598. --host1 imap-mail.outlook.com --ssl1 --user1 gilles.lamiral@outlook.com \
  5599. --passfile1 ../../var/pass/secret.outlook.com \
  5600. --host2 imap.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5601. --passfile2 ../../var/pass/secret.outlook.com \
  5602. --justlogin
  5603. }
  5604. outlook_login()
  5605. {
  5606. office365_justlogin_ssl1_ssl2
  5607. }
  5608. office365_justlogin_tls()
  5609. {
  5610. $CMD_PERL ./imapsync \
  5611. --host1 imap-mail.outlook.com --ssl1 --user1 gilles.lamiral@outlook.com \
  5612. --passfile1 ../../var/pass/secret.outlook.com \
  5613. --host2 imap.outlook.com --tls2 --user2 gilles.lamiral@outlook.com \
  5614. --passfile2 ../../var/pass/secret.outlook.com \
  5615. --justlogin
  5616. }
  5617. office365_justlogin_tls2_office365()
  5618. {
  5619. $CMD_PERL ./imapsync \
  5620. --host1 imap-mail.outlook.com --ssl1 --user1 gilles.lamiral@outlook.com \
  5621. --passfile1 ../../var/pass/secret.outlook.com \
  5622. --host2 outlook.office365.com --tls2 --user2 gilles.lamiral@outlook.com \
  5623. --passfile2 ../../var/pass/secret.outlook.com \
  5624. --justlogin
  5625. }
  5626. office365_justlogin_ssl2_tls2_office365()
  5627. {
  5628. # Should produce "BAD Command received in Invalid state."
  5629. $CMD_PERL ./imapsync \
  5630. --host1 imap-mail.outlook.com --ssl1 --user1 gilles.lamiral@outlook.com \
  5631. --passfile1 ../../var/pass/secret.outlook.com \
  5632. --host2 outlook.office365.com --tls2 --ssl2 --user2 gilles.lamiral@outlook.com \
  5633. --passfile2 ../../var/pass/secret.outlook.com \
  5634. --justlogin
  5635. test "$?" = "$EXIT_TLS_FAILURE"
  5636. }
  5637. office365_justlogin_nossl2_notls2_office365()
  5638. {
  5639. # Should also produce "BAD Command received in Invalid state."
  5640. ! $CMD_PERL ./imapsync \
  5641. --host1 imap-mail.outlook.com --ssl1 --user1 gilles.lamiral@outlook.com \
  5642. --passfile1 ../../var/pass/secret.outlook.com \
  5643. --host2 outlook.office365.com --notls2 --nossl2 --user2 gilles.lamiral@outlook.com \
  5644. --passfile2 ../../var/pass/secret.outlook.com \
  5645. --justlogin
  5646. }
  5647. office365_justconnect_stunnel_ks() {
  5648. $CMD_PERL ./imapsync \
  5649. --host1 outlook.office365.com --ssl1 \
  5650. --host2 ks.lamiral.info --port2 144 \
  5651. --justconnect
  5652. }
  5653. office365_justconnect_stunnel_i005() {
  5654. $CMD_PERL ./imapsync \
  5655. --host1 outlook.office365.com --ssl1 \
  5656. --host2 i005.lamiral.info --port2 144 \
  5657. --justconnect
  5658. }
  5659. office365_justconnect_inet4_inet6()
  5660. {
  5661. echo force ipv4
  5662. $CMD_PERL ./imapsync \
  5663. --host1 imap-mail.outlook.com \
  5664. --host2 outlook.office365.com \
  5665. --justconnect --inet4
  5666. echo
  5667. echo force ipv6
  5668. $CMD_PERL ./imapsync \
  5669. --host1 imap-mail.outlook.com \
  5670. --host2 outlook.office365.com \
  5671. --justconnect --inet6
  5672. echo
  5673. # outlook.office365.com gives ipv6 2a01:111:f400:2fa2::2
  5674. echo this one should fail but is does not
  5675. $CMD_PERL ./imapsync \
  5676. --host1 imap-mail.outlook.com \
  5677. --host2 2603:1026:4:51::2 \
  5678. --justconnect --inet4
  5679. echo
  5680. # outlook.office365.com gives ipv4 40.101.42.82
  5681. echo this one should fail but is does not
  5682. $CMD_PERL ./imapsync \
  5683. --host1 imap-mail.outlook.com \
  5684. --host2 40.101.42.82 \
  5685. --justconnect --inet6
  5686. echo
  5687. # outlook.office365.com gives ipv6 2603:1026:4:50::2
  5688. echo this one should succeed
  5689. $CMD_PERL ./imapsync \
  5690. --host1 2603:1026:4:51::2 \
  5691. --host2 imap-mail.outlook.com \
  5692. --justconnect
  5693. }
  5694. inet4_inet6()
  5695. {
  5696. echo
  5697. # outlook.office365.com gives ipv6 2603:1026:4:50::2
  5698. # outlook.office365.com gives ipv4 52.97.129.66
  5699. echo this one should succeed
  5700. $CMD_PERL ./imapsync \
  5701. --host1 2603:1026:4:50::2 \
  5702. --host2 52.97.129.66 \
  5703. --justconnect
  5704. echo this one should do ipv6
  5705. $CMD_PERL ./imapsync \
  5706. --host1 outlook.office365.com \
  5707. --host2 outlook.office365.com \
  5708. --justconnect --inet6
  5709. echo this one should do ipv4
  5710. $CMD_PERL ./imapsync \
  5711. --host1 outlook.office365.com \
  5712. --host2 outlook.office365.com \
  5713. --justconnect --inet4
  5714. }
  5715. l_office365_bigfolders()
  5716. {
  5717. $CMD_PERL ./imapsync \
  5718. --host1 $HOST1 --user1 tata \
  5719. --passfile1 ../../var/pass/secret.tata \
  5720. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5721. --passfile2 ../../var/pass/secret.outlook.com \
  5722. --tmpdir /var/tmp --useuid --include Junk.20
  5723. }
  5724. l_office365_maxline()
  5725. {
  5726. $CMD_PERL ./imapsync \
  5727. --host1 $HOST1 --user1 tata \
  5728. --passfile1 ../../var/pass/secret.tata \
  5729. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5730. --passfile2 ../../var/pass/secret.outlook.com \
  5731. --tmpdir /var/tmp --usecache --include Junk.2013 --maxlinelength 16000 --debugmaxlinelength
  5732. }
  5733. l_office365_maxline_2()
  5734. {
  5735. $CMD_PERL ./imapsync \
  5736. --host1 $HOST1 --user1 tata \
  5737. --passfile1 ../../var/pass/secret.tata \
  5738. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5739. --passfile2 ../../var/pass/secret.outlook.com \
  5740. --folder INBOX --regextrans2 's/INBOX/tata/' \
  5741. --minmaxlinelength 8000 --debugmaxlinelength
  5742. }
  5743. l_office365_maxline_3()
  5744. {
  5745. # It fails at 10240. So the fix is to cut at 10239
  5746. $CMD_PERL ./imapsync \
  5747. --host1 $HOST1 --user1 longlines \
  5748. --passfile1 ../../var/pass/secret.longlines \
  5749. --host2 imap-mail.outlook.com --user2 gilles.lamiral@outlook.com \
  5750. --passfile2 ../../var/pass/secret.outlook.com \
  5751. --tmpdir /var/tmp --usecache \
  5752. --folder INBOX --regextrans2 's/INBOX/longlines/' \
  5753. --debugmaxlinelength --errorsmax 1 --regexmess 's,(.{10239}),$1\r\n,g'
  5754. }
  5755. ll_empty_longlines()
  5756. {
  5757. ./imapsync \
  5758. --host1 $HOST1 --user1 longlines --passfile1 ../../var/pass/secret.longlines \
  5759. --host2 $HOST1 --user2 longlines --passfile2 ../../var/pass/secret.longlines \
  5760. --delete1 --noexpungeaftereach --delete1emptyfolders
  5761. }
  5762. # Only available on ks2 (filtered by a firewall)
  5763. l_exchange_maxline()
  5764. {
  5765. $CMD_PERL ./imapsync \
  5766. --host1 $HOST1 --user1 tata \
  5767. --passfile1 ../../var/pass/secret.tata \
  5768. --host2 correu.quopiam.com --ssl2 --user2 utest@quopiam.com \
  5769. --passfile2 ../../var/pass/secret.quopiam.com \
  5770. --tmpdir /var/tmp --usecache \
  5771. --folder INBOX --regextrans2 's/INBOX/longlines/' \
  5772. --minmaxlinelength 10000 --maxlinelength 11000 --debugmaxlinelength
  5773. }
  5774. # In mandatory_tests
  5775. fuzz_basic() {
  5776. zzuf -E '^' $CMD_PERL ./imapsync
  5777. }
  5778. # In mandatory_tests
  5779. fuzz_network() {
  5780. zzuf -E '^' -d -n $CMD_PERL ./imapsync \
  5781. --host1 $HOST1 --user1 tata \
  5782. --passfile1 ../../var/pass/secret.tata \
  5783. --host2 $HOST2 --user2 titi \
  5784. --passfile2 ../../var/pass/secret.titi \
  5785. --timeout 5
  5786. }
  5787. # general tests end
  5788. ##########################
  5789. # specific tests
  5790. ##########################
  5791. free_ssl() {
  5792. $CMD_PERL ./imapsync \
  5793. --host1 imap.free.fr --user1 gilles.lamiral@free.fr --passfile1 ../../var/pass/secret.gilles_free \
  5794. --host2 imap.free.fr --user2 gilles.lamiral@free.fr --passfile2 ../../var/pass/secret.gilles_free \
  5795. --justlogin --ssl1 --ssl2
  5796. }
  5797. # xgenplus still ok on Wed Apr 3 15:36:09 CEST 2019
  5798. xgenplus() {
  5799. $CMD_PERL ./imapsync \
  5800. --host1 imap.dataone.in --user1 imapsynctest@dataone.in \
  5801. --passfile1 ../../var/pass/secret.xgenplus \
  5802. --host2 imap.dataone.in --user2 imapsynctest@dataone.in \
  5803. --passfile2 ../../var/pass/secret.xgenplus \
  5804. --sep1 / --sep2 / --prefix1 "" --prefix2 "" --dry
  5805. }
  5806. xgenplus_feed() {
  5807. $CMD_PERL ./imapsync \
  5808. --host1 $HOST1 --user1 tata \
  5809. --passfile1 ../../var/pass/secret.tata \
  5810. --host2 imap.dataone.in --user2 imapsynctest@dataone.in \
  5811. --passfile2 ../../var/pass/secret.xgenplus \
  5812. --sep2 / --prefix2 "" \
  5813. --include "Junk.2013" --regextrans2 "s,Junk.2013,Junk," --dry
  5814. }
  5815. xgenplus_few() {
  5816. $CMD_PERL ./imapsync \
  5817. --host1 $HOST1 --user1 tata \
  5818. --passfile1 ../../var/pass/secret.tata \
  5819. --host2 imap.dataone.in --user2 imapsynctest@dataone.in \
  5820. --passfile2 ../../var/pass/secret.xgenplus \
  5821. --sep2 / --prefix2 "" \
  5822. --include "few_emails" --dry
  5823. }
  5824. firstclass() {
  5825. $CMD_PERL ./imapsync \
  5826. --host1 mail.una.ab.ca \
  5827. --user1 glamiral --passfile1 ../../var/pass/secret.firstclass \
  5828. --host2 mail.una.ab.ca \
  5829. --user2 glamiral --passfile2 ../../var/pass/secret.firstclass \
  5830. --dry --useuid --debugcontent
  5831. }
  5832. firstclass_fullfill() {
  5833. $CMD_PERL ./imapsync \
  5834. --host1 $HOST1 --user1 tata \
  5835. --passfile1 ../../var/pass/secret.tata \
  5836. --host2 mail.una.ab.ca \
  5837. --user2 glamiral --passfile2 ../../var/pass/secret.firstclass \
  5838. --debugcontent \
  5839. --folder INBOX.few_emails --f1f2 'INBOX.few_emails=INBOX'
  5840. }
  5841. Alessandro_error_11()
  5842. {
  5843. # $CMD_PERL ./imapsync \
  5844. # --host1 $HOST1 --user1 tata \
  5845. # --passfile1 ../../var/pass/secret.tata \
  5846. # --host2 $HOST2 --user2 titi \
  5847. # --passfile2 ../../var/pass/secret.titi \
  5848. # --folder INBOX.error_11 --debugcontent --nodry --nodry1 --pipemess 'cat /g/Alessandro_error_11.txt'
  5849. $CMD_PERL ./imapsync \
  5850. --host1 $HOST1 --user1 tata \
  5851. --passfile1 ../../var/pass/secret.tata \
  5852. --host2 imap-mail.outlook.com --ssl2 --user2 gilles.lamiral@outlook.com \
  5853. --passfile2 ../../var/pass/secret.outlook.com \
  5854. --folder INBOX.error_11 --debugcontent --nodry --nodry1 --pipemess 'cat /g/Alessandro_error_11.txt' \
  5855. --regexmess "s{\QSubject: =?TELETEX?Q?Fw=3APresentation_Storia_dell=5C=27Informatica?=\E}{Subject: Presentation Storia dell'Informatica}"
  5856. # Subject: =?TELETEX?Q?Fw=3APresentation_Storia_dell=5C=27Informatica?=
  5857. # Subject: Presentation Storia dell'Informatica
  5858. #--pipemess W/tools/fix_email_for_exchange.py
  5859. #--pipemess 'reformime -r7'
  5860. }
  5861. # End of specific tests
  5862. huge_folder()
  5863. {
  5864. date1=`date`
  5865. { $CMD_PERL ./imapsync \
  5866. --host1 $HOST1 --user1 gilles@est.belle \
  5867. --passfile1 ../../var/pass/secret.gilles_mbox \
  5868. --host2 $HOST2 --user2 tete@est.belle \
  5869. --passfile2 ../../var/pass/secret.tete \
  5870. --include INBOX.Junk.2010 \
  5871. --tmpdir /var/tmp --debugmemory || \
  5872. true
  5873. }
  5874. date2=`date`
  5875. echo3 "[$date1] [$date2]"
  5876. }
  5877. huge_folder_headers_ALL()
  5878. {
  5879. date1=`date`
  5880. { $CMD_PERL ./imapsync \
  5881. --host1 $HOST1 --user1 gilles@est.belle \
  5882. --passfile1 ../../var/pass/secret.gilles_mbox \
  5883. --host2 $HOST2 --user2 tete@est.belle \
  5884. --passfile2 ../../var/pass/secret.tete \
  5885. --include INBOX.Junk.2010 \
  5886. --tmpdir /var/tmp --useheader ALL --debugmemory || \
  5887. true
  5888. }
  5889. date2=`date`
  5890. echo3 "[$date1] [$date2]"
  5891. }
  5892. huge_folder_2018()
  5893. {
  5894. date1=`date`
  5895. { $CMD_PERL ./imapsync \
  5896. --host1 $HOST1 --user1 gilles@est.belle \
  5897. --passfile1 ../../var/pass/secret.gilles_mbox \
  5898. --host2 $HOST2 --user2 gilles@est.belle \
  5899. --passfile2 ../../var/pass/secret.gilles_mbox \
  5900. --folder INBOX.Junk \
  5901. --f1f2 INBOX.Junk=INBOX.Junk.2018 \
  5902. --search "SENTBEFORE 1-Jan-2019" \
  5903. --tmpdir /var/tmp --usecache --delete1
  5904. }
  5905. date2=`date`
  5906. echo3 "[$date1] [$date2]"
  5907. }
  5908. huge_message_ks()
  5909. {
  5910. date1=`date`
  5911. { $CMD_PERL ./imapsync \
  5912. --host1 $HOST1 --user1 tata \
  5913. --passfile1 ../../var/pass/secret.tata \
  5914. --host2 $HOST2 --user2 tete \
  5915. --passfile2 ../../var/pass/secret.tete \
  5916. --folder INBOX --minsize 100000000 \
  5917. --tmpdir /var/tmp --debugmemory --nofoldersizes
  5918. }
  5919. date2=`date`
  5920. echo3 "[$date1] [$date2]"
  5921. echo3 'rm -f /home/tete/Maildir/cur/*'
  5922. }
  5923. huge_folder_ks()
  5924. {
  5925. date1=`date`
  5926. { $CMD_PERL ./imapsync \
  5927. --host1 $HOST1 --user1 tata \
  5928. --passfile1 ../../var/pass/secret.tata \
  5929. --host2 $HOST2 --user2 tete \
  5930. --passfile2 ../../var/pass/secret.tete \
  5931. --include Junk.2010 \
  5932. --tmpdir /var/tmp
  5933. }
  5934. date2=`date`
  5935. echo3 "[$date1] [$date2]"
  5936. echo3 'rm -f /home/tete/Maildir/.Junk.2010/cur/*'
  5937. }
  5938. huge_folder_useuid()
  5939. {
  5940. date1=`date`
  5941. { $CMD_PERL ./imapsync \
  5942. --host1 $HOST1 --user1 gilles@est.belle \
  5943. --passfile1 ../../var/pass/secret.gilles_mbox \
  5944. --host2 $HOST2 --user2 tete@est.belle \
  5945. --passfile2 ../../var/pass/secret.tete \
  5946. --include INBOX.Junk.20 --foldersizes \
  5947. --useuid --tmpdir /var/tmp --delete2 || \
  5948. true
  5949. }
  5950. date2=`date`
  5951. echo3 "[$date1] [$date2]"
  5952. }
  5953. huge_folder_sizes_only()
  5954. {
  5955. date1=`date`
  5956. { $CMD_PERL ./imapsync \
  5957. --host1 $HOST1 --user1 gilles@est.belle \
  5958. --passfile1 ../../var/pass/secret.gilles_mbox \
  5959. --host2 $HOST2 --user2 tete@est.belle \
  5960. --passfile2 ../../var/pass/secret.tete \
  5961. --justfoldersizes --folder INBOX.Junk.2010 || \
  5962. true
  5963. }
  5964. date2=`date`
  5965. echo3 "[$date1] [$date2]"
  5966. }
  5967. huge_folder_fast()
  5968. {
  5969. date1=`date`
  5970. { $CMD_PERL ./imapsync \
  5971. --host1 $HOST1 --user1 gilles@est.belle \
  5972. --passfile1 ../../var/pass/secret.gilles_mbox \
  5973. --host2 $HOST2 --user2 tete@est.belle \
  5974. --passfile2 ../../var/pass/secret.tete \
  5975. --folder INBOX.Junk.2010 \
  5976. --fast || \
  5977. true
  5978. }
  5979. date2=`date`
  5980. echo3 "[$date1] [$date2]"
  5981. }
  5982. huge_folder_fast2()
  5983. {
  5984. date1=`date`
  5985. { $CMD_PERL ./imapsync \
  5986. --host1 $HOST1 --user1 gilles@est.belle \
  5987. --passfile1 ../../var/pass/secret.gilles_mbox \
  5988. --host2 $HOST2 --user2 tete@est.belle \
  5989. --passfile2 ../../var/pass/secret.tete \
  5990. --folder INBOX.Junk \
  5991. --fast || \
  5992. true
  5993. }
  5994. date2=`date`
  5995. echo3 "[$date1] [$date2]"
  5996. echo3 'rm -f /home/vmail/tete/.Junk/cur/*'
  5997. }
  5998. dprof_justfoldersizes()
  5999. {
  6000. date1=`date`
  6001. { $CMD_PERL -d:DProf ./imapsync \
  6002. --host1 $HOST1 --user1 gilles@est.belle \
  6003. --passfile1 ../../var/pass/secret.gilles_mbox \
  6004. --host2 $HOST2 --user2 tete@est.belle \
  6005. --passfile2 ../../var/pass/secret.tete \
  6006. --justfoldersizes --folder INBOX.Junk || \
  6007. true
  6008. }
  6009. date2=`date`
  6010. echo3 "[$date1] [$date2]"
  6011. mv tmon.out dprof_justfoldersizes_tmon.out
  6012. dprofpp -O 30 dprof_justfoldersizes_tmon.out
  6013. dprofpp -O 30 -I dprof_justfoldersizes_tmon.out
  6014. }
  6015. bigfolder()
  6016. {
  6017. date1=`date`
  6018. date1epoch=`date +%s`
  6019. $CMD_PERL ./imapsync \
  6020. --host1 $HOST1 --user1 gilles@est.belle \
  6021. --passfile1 ../../var/pass/secret.gilles_mbox \
  6022. --host2 $HOST2 --user2 tete@est.belle \
  6023. --passfile2 ../../var/pass/secret.tete \
  6024. --foldersizes --folder INBOX.Junk.2010 --usecache
  6025. date2=`date`
  6026. date2epoch=`date +%s`
  6027. $CMD_PERL ./imapsync \
  6028. --host1 $HOST1 --user1 gilles@est.belle \
  6029. --passfile1 ../../var/pass/secret.gilles_mbox \
  6030. --host2 $HOST2 --user2 tete@est.belle \
  6031. --passfile2 ../../var/pass/secret.tete \
  6032. --foldersizes --folder INBOX.Junk.2010
  6033. date3=`date`
  6034. date3epoch=`date +%s`
  6035. $CMD_PERL ./imapsync \
  6036. --host1 $HOST1 --user1 gilles@est.belle \
  6037. --passfile1 ../../var/pass/secret.gilles_mbox \
  6038. --host2 $HOST2 --user2 tete@est.belle \
  6039. --passfile2 ../../var/pass/secret.tete \
  6040. --foldersizes --folder INBOX.Junk.2010 --usecache
  6041. date4=`date`
  6042. date4epoch=`date +%s`
  6043. $CMD_PERL ./imapsync \
  6044. --host1 $HOST1 --user1 gilles@est.belle \
  6045. --passfile1 ../../var/pass/secret.gilles_mbox \
  6046. --host2 $HOST2 --user2 tete@est.belle \
  6047. --passfile2 ../../var/pass/secret.tete \
  6048. --foldersizes --folder INBOX.Junk.2010
  6049. date5=`date`
  6050. date5epoch=`date +%s`
  6051. $CMD_PERL ./imapsync \
  6052. --host1 $HOST1 --user1 gilles@est.belle \
  6053. --passfile1 ../../var/pass/secret.gilles_mbox \
  6054. --host2 $HOST2 --user2 tete@est.belle \
  6055. --passfile2 ../../var/pass/secret.tete \
  6056. --foldersizes --folder INBOX.Junk.2010 --usecache
  6057. date6=`date`
  6058. date6epoch=`date +%s`
  6059. $CMD_PERL ./imapsync \
  6060. --host1 $HOST1 --user1 gilles@est.belle \
  6061. --passfile1 ../../var/pass/secret.gilles_mbox \
  6062. --host2 $HOST2 --user2 tete@est.belle \
  6063. --passfile2 ../../var/pass/secret.tete \
  6064. --foldersizes --folder INBOX.Junk.2010
  6065. date7=`date`
  6066. date7epoch=`date +%s`
  6067. diff_21=`expr $date2epoch - $date1epoch`
  6068. diff_32=`expr $date3epoch - $date2epoch`
  6069. diff_43=`expr $date4epoch - $date3epoch`
  6070. diff_54=`expr $date5epoch - $date4epoch`
  6071. diff_65=`expr $date6epoch - $date5epoch`
  6072. diff_76=`expr $date7epoch - $date6epoch`
  6073. diff_32_21=`expr $diff_32 - $diff_21`
  6074. diff_54_43=`expr $diff_54 - $diff_43`
  6075. diff_76_65=`expr $diff_76 - $diff_65`
  6076. echo "[$date1] [$date2] [$date3] [$date4] [$date5] [$date6] [$date7]" | tee -a bigfolder.txt
  6077. echo "diff [$diff_21] [$diff_32] [$diff_43] [$diff_54] [$diff_65] [$diff_76]" | tee -a bigfolder.txt
  6078. echo "diff cache pas cache [$diff_32_21] [$diff_54_43] [$diff_76_65]" | tee -a bigfolder.txt
  6079. echo >> bigfolder.txt
  6080. }
  6081. dprof_bigfolder()
  6082. {
  6083. date1=`date`
  6084. { $CMD_PERL -d:DProf ./imapsync \
  6085. --host1 $HOST1 --user1 gilles@est.belle \
  6086. --passfile1 ../../var/pass/secret.gilles_mbox \
  6087. --host2 $HOST2 --user2 tete@est.belle \
  6088. --passfile2 ../../var/pass/secret.tete \
  6089. --nofoldersizes --folder INBOX.03_imapsync.imapsync_list || \
  6090. true
  6091. }
  6092. date2=`date`
  6093. echo3 "[$date1] [$date2]"
  6094. mv tmon.out dprof_bigfolder_tmon.out
  6095. dprofpp -O 30 dprof_bigfolder_tmon.out
  6096. dprofpp -O 30 -I dprof_bigfolder_tmon.out
  6097. }
  6098. dprof_bigmail()
  6099. {
  6100. date1=`date`
  6101. { $CMD_PERL -d:DProf ./imapsync \
  6102. --host1 $HOST1 --user1 tata \
  6103. --passfile1 ../../var/pass/secret.tata \
  6104. --host2 $HOST2 --user2 titi \
  6105. --passfile2 ../../var/pass/secret.titi \
  6106. --folder INBOX.bigmail --dry --maxlinelength 8888
  6107. echo 'sudo sh -c "rm -v /home/vmail/titi/.bigmail/cur/*"' || \
  6108. true
  6109. }
  6110. date2=`date`
  6111. echo3 "[$date1] [$date2]"
  6112. mv tmon.out W/dprof_bigmail_tmon.out
  6113. dprofpp -O 30 W/dprof_bigmail_tmon.out
  6114. dprofpp -O 30 -I W/dprof_bigmail_tmon.out
  6115. }
  6116. nytprof_bigmail()
  6117. {
  6118. date1=`date`
  6119. { $CMD_PERL -d:NYTProf ./imapsync \
  6120. --host1 $HOST1 --user1 tata \
  6121. --passfile1 ../../var/pass/secret.tata \
  6122. --host2 $HOST2 --user2 titi \
  6123. --passfile2 ../../var/pass/secret.titi \
  6124. --folder INBOX.bigmail --dry --maxlinelength 8888
  6125. echo 'sudo sh -c "rm -v /home/vmail/titi/.bigmail/cur/*"' || \
  6126. true
  6127. }
  6128. date2=`date`
  6129. echo3 "[$date1] [$date2]"
  6130. }
  6131. ll_nytprof()
  6132. {
  6133. date1=`date`
  6134. # one time without NYTProf
  6135. { $CMD_PERL ./imapsync \
  6136. --host1 $HOST1 --user1 tata \
  6137. --passfile1 ../../var/pass/secret.tata \
  6138. --host2 $HOST2 --user2 titi \
  6139. --passfile2 ../../var/pass/secret.titi
  6140. }
  6141. date2=`date`
  6142. # then one time with NYTProf
  6143. { $CMD_PERL -d:NYTProf ./imapsync \
  6144. --host1 $HOST1 --user1 tata \
  6145. --passfile1 ../../var/pass/secret.tata \
  6146. --host2 $HOST2 --user2 titi \
  6147. --passfile2 ../../var/pass/secret.titi
  6148. }
  6149. date3=`date`
  6150. echo3 "begin: [$date1]"
  6151. echo3 "first: [$date2]"
  6152. echo3 "end: [$date3]"
  6153. }
  6154. dprof2_bigmail()
  6155. {
  6156. date1=`date`
  6157. { $CMD_PERL -d:Profile ./imapsync \
  6158. --host1 $HOST1 --user1 tata \
  6159. --passfile1 ../../var/pass/secret.tata \
  6160. --host2 $HOST2 --user2 titi \
  6161. --passfile2 ../../var/pass/secret.titi \
  6162. --folder INBOX.bigmail --debugmemory --dry
  6163. echo 'sudo sh -c "rm -v /home/vmail/titi/.bigmail/cur/*"' || \
  6164. true
  6165. }
  6166. date2=`date`
  6167. echo3 "[$date1] [$date2]"
  6168. mv prof.out W/dprof2_bigmail_tmon.out
  6169. }
  6170. curl_online_args()
  6171. {
  6172. curl -v --data 'host1=test1.lamiral.info;user1=test1;password1=secret1;host2=test2.lamiral.info;user2=test2;password2=secret2;simulong=2' \
  6173. https://imapsync.lamiral.info/cgi-bin/imapsync
  6174. }
  6175. curl_online_testslive()
  6176. {
  6177. curl -v --data 'testslive=1;simulong=2' https://imapsync.lamiral.info/cgi-bin/imapsync
  6178. }
  6179. curl_online_args_pidfile()
  6180. {
  6181. curl -v --data"host1=test1.lamiral.info;user1=test1;password1=secret1;host2=test2.lamiral.info;user2=test2;password2=secret2;pidfile=/tmp/curl_online_args_pidfile_$$.txt" \
  6182. https://imapsync.lamiral.info/cgi-bin/imapsync
  6183. }
  6184. curl_online_args_nolog()
  6185. {
  6186. curl -v --data 'host1=test1.lamiral.info;user1=test1;password1=secret1;host2=test2.lamiral.info;user2=test2;password2=secret2;justbanner=1;log=' \
  6187. https://lamiral.info/cgi-bin/imapsync
  6188. }
  6189. curl_online_args_nolog_2()
  6190. {
  6191. curl -v --data 'host1=test1.lamiral.info;user1=test1;password1=secret1;host2=test2.lamiral.info;user2=test2;password2=secret2;justbanner=1;log=0' \
  6192. https://lamiral.info/cgi-bin/imapsync
  6193. }
  6194. curl_online_justbanner()
  6195. {
  6196. curl -v --data 'host1=test1.lamiral.info;user1=test1;password1=secret1;host2=test2.lamiral.info;user2=test2;password2=secret2;simulong=0.7;justbanner=1' \
  6197. https://lamiral.info/cgi-bin/imapsync
  6198. }
  6199. curl_online_file()
  6200. {
  6201. cat > W/tmp/cred.txt <<EOF
  6202. host1=test1.lamiral.info;
  6203. user1=test1;
  6204. password1=secret1;
  6205. host2=test2.lamiral.info;
  6206. user2=test2;
  6207. password2=secret2;
  6208. simulong=2;
  6209. dry=1;
  6210. EOF
  6211. curl -v --data '@W/tmp/cred.txt' \
  6212. https://imapsync.lamiral.info/cgi-bin/imapsync
  6213. }
  6214. curl_online_args_json()
  6215. {
  6216. # DO NOT WORK AT ALL
  6217. ! curl -v --data '{ "testslive":"1" }' -H "Content-Type: application/json" \
  6218. https://imapsync.lamiral.info/cgi-bin/imapsync
  6219. }
  6220. # * 1.810 https://tools.controlpanel.si/imapsync/ CGI https://tools.controlpanel.si/cgi-bin/imapsync
  6221. # * 1.882 https://tools.intertune.io/imapsync/X/ CGI https://tools.intertune.io/cgi-bin/imapsync
  6222. # * 1.882 https://imapsync.whc.ca/ CGI https://imapsync.whc.ca/cgi-bin/imapsync
  6223. # * 1.925 https://imapsync.boomhost.com/ CGI https://imapsync.boomhost.com/cgi-bin/imapsync
  6224. # * 1.977 https://imapcopy.webhosting4u.gr/ CGI https://imapcopy.webhosting4u.gr/cgi-bin/imapsync
  6225. # * 1.991 https://imapsync.nl/ CGI https://imapsync.nl/cgi-bin/imapsync
  6226. # * 1.998 https://mailsync.timetakernet.info/ CGI https://mailsync.timetakernet.info/cgi-bin/imapsync
  6227. #Detected by releasecheck:
  6228. # * 1.957 http://migracao.hahost.com.br/migrar2.html CGI http://migracao.hahost.com.br/cgi-bin/imapsync
  6229. # * 1.967 CGI https://jcenter.nara-edu.ac.jp/cgi-bin/imapsync
  6230. # * 1.973 http://77.68.7.106/ CGI http://77.68.7.106/cgi-bin/imapsync
  6231. # * 1.979 CGI http://mail2.nara-edu.ac.jp/cgi-bin/imapsync
  6232. # * 1.979 CGI https://imapsync.bepulse.com/cgi-bin/imapsync
  6233. # * 1.990 https://transfer.keliweb.com/X/ CGI https://transfer.keliweb.com/cgi-bin/imapsync
  6234. # * 1.998 CGI https://web-tools.na.icb.cnr.it/cgi-bin/imapsync
  6235. # * 1.998 CGI https://140.164.23.4/cgi-bin/imapsync
  6236. # * ?.??? https://app.migrationwizard.co.uk/ CGI 404, deep into https://app.migrationwizard.co.uk/sync.php
  6237. curl_online_external()
  6238. {
  6239. # curl
  6240. # -v verbose
  6241. # -s silent
  6242. for imapsync in \
  6243. https://imapsync.lamiral.info/cgi-bin/imapsync \
  6244. https://tools.controlpanel.si/cgi-bin/imapsync \
  6245. https://tools.intertune.io/cgi-bin/imapsync \
  6246. https://imapsync.whc.ca/cgi-bin/imapsync \
  6247. https://imapsync.boomhost.com/cgi-bin/imapsync \
  6248. https://imapcopy.webhosting4u.gr/cgi-bin/imapsync \
  6249. https://imapsync.nl/cgi-bin/imapsync \
  6250. https://mailsync.timetakernet.info/cgi-bin/imapsync \
  6251. https://jcenter.nara-edu.ac.jp/cgi-bin/imapsync \
  6252. https://imapsync.bepulse.com/cgi-bin/imapsync \
  6253. https://transfer.keliweb.com/cgi-bin/imapsync \
  6254. https://web-tools.na.icb.cnr.it/cgi-bin/imapsync \
  6255. https://140.164.23.4/cgi-bin/imapsync \
  6256. ; do
  6257. curl -k -s --data 'justconnect=1;host1=mail.unionstrategiesinc.com;user1=a;user2=a;host2=mail5.unionstrategiesinc.com;simulong=2' \
  6258. $imapsync
  6259. #sleep 2
  6260. done
  6261. }
  6262. ##########################
  6263. ##########################
  6264. # Tests list
  6265. mandatory_tests='
  6266. no_args
  6267. option_version
  6268. option_tests
  6269. option_tests_in_var_tmp
  6270. option_tests_in_var_tmp_sub
  6271. option_testsdebug
  6272. option_releasecheck
  6273. option_noreleasecheck
  6274. option_bad_delete2
  6275. option_extra_arguments
  6276. option_extra
  6277. passfile1_noexist
  6278. passfile2_noexist
  6279. passwords_masked
  6280. passwords_not_masked
  6281. first_sync_dry
  6282. first_sync
  6283. ll
  6284. ll_host_sanitize
  6285. pidfile_well_removed
  6286. pidfile_bad
  6287. ll_pidfilelocking
  6288. test_tail
  6289. justbanner
  6290. nomodules_version
  6291. xxxxx_gmail
  6292. gmail_xxxxx
  6293. gmail
  6294. gmail_gmail
  6295. gmail_gmail_INBOX
  6296. gmail_gmail_folderfirst
  6297. gmail_glX_all_justlogin
  6298. yahoo_xxxx_login_tls
  6299. yahoo_xxxx_login
  6300. yahoo_xxxx
  6301. yahoo_fail_UNAVAILABLE
  6302. free_ssl
  6303. office365_justconnect_inet4_inet6
  6304. office365_justconnect_tls_SSL_verify_mode_1
  6305. ll_unknow_option
  6306. ll_ask_password
  6307. ll_env_password
  6308. ll_bug_folder_name_with_blank
  6309. ll_skipcrossduplicates_usecache
  6310. ll_timeout
  6311. ll_timeout1_timeout2
  6312. ll_timeout_very_small
  6313. ll_folder
  6314. ll_folder_noexist
  6315. ll_folder_mixfolders
  6316. ll_nocheckselectable
  6317. ll_checkselectable
  6318. ll_checkselectable_nb_folders
  6319. ll_nocheckfoldersexist
  6320. ll_checkfoldersexist
  6321. ll_subfolder2
  6322. ll_subfolder1
  6323. ll_subfolder1_INBOX_SUB
  6324. ll_subfolder1_DOES_NOT_EXIST
  6325. ll_oneemail
  6326. ll_buffersize
  6327. ll_justfolders
  6328. ll_justfolders_delete1emptyfolders
  6329. ll_justfolders_skipemptyfolders
  6330. ll_f1f2_01
  6331. ll_prefix12
  6332. ll_nosyncinternaldates
  6333. ll_idatefromheader
  6334. ll_folder_rev
  6335. ll_subscribed
  6336. ll_nosubscribe
  6337. ll_justfoldersizes
  6338. ll_justfoldersizes_noexist
  6339. ll_authmd5
  6340. ll_authmd51
  6341. ll_authmd52
  6342. ll_noauthmd5
  6343. ll_maxage
  6344. ll_maxsize
  6345. ll_skipsize
  6346. ll_skipheader
  6347. ll_include
  6348. ll_exclude
  6349. ll_exclude_INBOX
  6350. ll_regextrans2
  6351. ll_sep2
  6352. ll_bad_login
  6353. ll_authentication_failure_user1
  6354. ll_authentication_failure_user2
  6355. ll_authentication_failure_user12
  6356. ll_bad_host1
  6357. ll_bad_host2
  6358. ll_bad_host12
  6359. ll_bad_host_ssl
  6360. ll_useheader
  6361. ll_useheader_noheader
  6362. ll_regexmess
  6363. ll_regexmess_8bit_X
  6364. ll_regexmess_bad_regex
  6365. ll_regexmess_add_header
  6366. ll_regexmess_add_header_path
  6367. ll_regexmess_scwchu
  6368. ll_skipmess
  6369. ll_skipmess_8bits
  6370. ll_skipmess_Content_Type_Message_partial
  6371. ll_pipemess_nocmd
  6372. ll_pipemess_false
  6373. ll_pipemess_true
  6374. ll_pipemess
  6375. ll_pipemess_catcat
  6376. ll_flags
  6377. ll_resyncflags
  6378. ll_noresyncflags
  6379. ll_syncflagsaftercopy
  6380. ll_regex_flag
  6381. ll_regex_flag_bad
  6382. ll_regex_flag_keep_only
  6383. ll_justconnect
  6384. ll_justconnect_ipv6
  6385. ll_justconnect_ipv6_nossl
  6386. ll_justhost1
  6387. ll_justhost2
  6388. ll_justlogin
  6389. ll_justconnect_devel
  6390. ll_ssl
  6391. ll_ssl_justconnect
  6392. ll_ssl_justlogin
  6393. ll_ssl_justconnect_sslargs
  6394. ll_tls_justconnect
  6395. ll_tls_justlogin
  6396. ll_tls
  6397. ll_tls_justlogin_sslargs_failure_EXIT_TLS_FAILURE
  6398. ll_authmech_PLAIN
  6399. ll_authmech_xoauth2_gmail
  6400. ll_authmech_xoauth2_json_gmail
  6401. ll_authmech_LOGIN
  6402. ll_authmech_CRAMMD5
  6403. ll_authmech_PREAUTH
  6404. ll_authmech_NTLM
  6405. ll_authmech_NTLM_domain
  6406. ll_authmech_NTLM_trylogin_ok
  6407. ll_authmech_NTLM_trylogin_fail
  6408. ll_authuser
  6409. ll_proxyauth_missing_authuser
  6410. ll_proxyauth_authuser
  6411. ll_delete1_delete2
  6412. ll_delete2
  6413. ll_delete1
  6414. ll_delete1_twoemails
  6415. ll_folderrec
  6416. ll_memory_consumption
  6417. ll_newmessage
  6418. ll_usecache
  6419. ll_usecache_noheader
  6420. ll_usecache_debugcache
  6421. ll_nousecache
  6422. ll_delete2foldersonly_NEW_3
  6423. ll_delete2foldersonly_dry
  6424. ll_delete2foldersonly_subfolder2
  6425. ll_delete2foldersbutnot
  6426. ll_folder_create
  6427. ll_folder_create_INBOX_Inbox
  6428. ll_delete2folders
  6429. ll_useuid
  6430. ll_useuid_nousecache
  6431. ll_noheader_force
  6432. ll_noheader
  6433. ll_domino1_domino2
  6434. ll_domino2
  6435. ll_with_flags_errors
  6436. ll_errorsmax
  6437. ll_exitwhenover
  6438. ll_exitwhenover_noerrorsdump
  6439. fuzz_basic
  6440. fuzz_network
  6441. testslive
  6442. testslive6
  6443. ll_abort_pidfile_no_exist
  6444. ll_abort_noprocess
  6445. ll_abort_not_a_pid_number
  6446. ll_abort_basic
  6447. ll_abort_cgi_context_tail
  6448. ll_abort_no_pidfile_option
  6449. ll_abort_byfile_hand_made
  6450. ll_abort_byfile_imapsync_made
  6451. ll_abort_byfile_normal_run
  6452. ll_sigreconnect_INT
  6453. ll_diff_log_stdout_debugssl
  6454. curl_online_args
  6455. curl_online_file
  6456. ksks_reset_test1
  6457. memory_stress
  6458. '
  6459. # 2019_12 Removed
  6460. # ks_justconnect_ipv6_nossl
  6461. # ks_justconnect_ipv6
  6462. other_tests='
  6463. archiveopteryx_1
  6464. msw
  6465. msw2
  6466. ll_bigmail
  6467. ll_justlogin_backslash_char
  6468. '
  6469. l() {
  6470. echo "$mandatory_tests" "$other_tests"
  6471. }
  6472. # minimal and fatal tests
  6473. run_tests perl_syntax || exit 1
  6474. set_return_code_variables
  6475. if test $# -eq 0; then
  6476. # mandatory tests
  6477. if run_tests $mandatory_tests; then
  6478. ./imapsync --version >> .tests_passed
  6479. return 0
  6480. fi
  6481. else
  6482. # selective tests
  6483. run_tests "$@"
  6484. return $?
  6485. fi