db_updater: Put parentheses back
[merlin.git] / bltest.c
blob9bd677a1becc3a48edbc8bbe6899f58ae9060d3a
1 #include "binlog.h"
2 #include "colors.h"
3 #include "test_utils.h"
4 #include "shared.h"
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <stdio.h>
8 #include <unistd.h>
9 #include <stdlib.h>
10 #include <string.h>
13 /* autogenerated message list, produced by fortune */
14 static char *msg_list[] = {
15 "Life, loathe it or ignore it, you can't like it.",
16 "SOMEONE ELSE.",
17 "... all the modern inconveniences ...",
18 "one when he was a boy and one when he was a man.",
19 "Not Hercules could have knock'd out his brains, for he had none.",
20 "When you ascend the hill of prosperity may you not meet a friend.",
21 "You have been in Afghanistan, I perceive.",
22 "Good afternoon, madam. How may I help you?",
23 "Good afternoon. I'd like a FrintArms HandCannon, please.",
24 "I'll take the special.",
25 "Sound choice, madam, *sound* choice. Now, do--?",
26 "Aah... yes, And how does madam wish to pay?",
27 "Benson, you are so free of the ravages of intelligence",
28 "First things first -- but not necessarily in that order",
29 "It's kind of fun to do the impossible.",
30 "My life is a soap opera, but who has the rights?",
31 "No, `Eureka' is Greek for `This bath is too hot.'",
32 "'Close to You'. Hit it, boys!",
33 "Rembrandt's first name was Beauregard, which is why he never used it.",
34 "Spare no expense to save money on this one.",
35 "and it will be a sell out.",
36 "Truth is stranger than fiction, because fiction has to make sense.",
37 "Well, that was a piece of cake, eh K-9?",
38 "You've got to have a gimmick if your band sucks.",
39 "Why bother? He's probably home reading the Encyclopedia Britannica.",
40 "The Tao is embodied in all software -- regardless of how insignificant,",
41 "I said, 'No. Wrong. Game over. Next contestant, please.'",
42 "But what we need to know is, do people want nasally-insertable computers?",
43 "How do I love thee? My accumulator overflows.",
44 "If that makes any sense to you, you have a big problem.",
45 "Is it PC compatible?",
46 "It runs like _\bx, where _\bx is something unsavory",
47 "It's not just a computer -- it's your ass.",
48 "The Other Side.",
49 "This ... this is your canvas! your clay! Go forth and create a masterwork!",
50 "Now this is a totally brain damaged algorithm. Gag me with a smurfette.",
51 "Nuclear war can ruin your whole compile.",
52 "One basic notion underlying Usenet is that it is a cooperative.",
53 "Pascal is Pascal is Pascal is dog meat.",
54 "1 is prime, 1 is prime, 1 is prime, 1 is prime...",
55 "The Computer made me do it.",
56 "This is lemma 1.1. We start a new chapter so the numbers all go back to one.",
57 "We are on the verge: Today our program proved Fermat's next-to-last theorem.",
58 "What is the Nature of God?",
59 "I've just GOT to start labeling my software...",
60 "You can't make a program without broken egos.",
61 "If it ain't broke, don't fix it.",
62 "The one charm of marriage is that it makes a life of deception a neccessity.",
63 "God is a comedian playing to an audience too afraid to laugh.",
64 "There are things that are so serious that you can only joke about them",
65 "Confound these ancestors.... They've stolen our best ideas!",
66 "All my life I wanted to be someone; I guess I should have been more specific.",
67 "The greatest warriors are the ones who fight for peace.",
68 "No matter where you go, there you are...",
69 "I'm growing older, but not up.",
70 "I hate the itching. But I don't mind the swelling.",
71 "Oh dear, I think you'll find reality's on the blink again.",
72 "Send lawyers, guns and money...",
73 "I go on working for the same reason a hen goes on laying eggs.",
74 "Jesus may love you, but I think you're garbage wrapped in skin.",
75 "Well the diagnostics say it's fine buddy, so it's a software problem.",
76 "Show business is just like high school, except you get paid.",
77 "This isn't brain surgery; it's just television.",
78 "Morality is one thing. Ratings are everything.",
79 "Catch a wave and you're sitting on top of the world.",
80 "That's a known problem... don't worry about it.",
81 "I am your density.",
82 "So why don't you make like a tree, and get outta here.",
83 "Falling in love makes smoking pot all day look like the ultimate in restraint.",
84 "I may kid around about drugs, but really, I take them seriously.",
85 "Live or die, I'll make a million.",
86 "Come on over here, baby, I want to do a thing with you.",
87 "Ahead warp factor 1",
88 "Of all the tyrannies that affect mankind, tyranny in religion is the worst.",
89 "I say we take off; nuke the site from orbit. It's the only way to be sure.",
90 "Unibus timeout fatal trap program lost sorry",
91 "If you'll excuse me a minute, I'm going to have a cup of coffee.",
92 "I'm a mean green mother from outer space",
93 "There is no statute of limitations on stupidity.",
94 "We can't schedule an orgy, it might be construed as fighting",
95 "Ada is the work of an architect, not a computer scientist.",
96 "I think every good Christian ought to kick Falwell's ass.",
97 "You need tender loving care once a week - so that I can slap you into shape.",
98 "Why should we subsidize intellectual curiosity?",
99 "Plan to throw one away. You will anyway.",
100 "Why should we subsidize intellectual curiosity?",
101 "I have just one word for you, my boy...plastics.",
102 "There is such a fine line between genius and stupidity.",
103 "If Diet Coke did not exist it would have been neccessary to invent it.",
104 "Your attitude determines your attitude.",
105 "If you want to eat hippopatomus, you've got to pay the freight.",
106 "We will bury you.",
107 "Now here's something you're really going to like!",
108 "How to make a million dollars: First, get a million dollars.",
109 "Language shapes the way we think, and determines what we can think about.",
110 "For the love of phlegm...a stupid wall of death rays. How tacky can ya get?",
111 "Bureaucracy is the enemy of innovation.",
112 "An organization dries up if you don't challenge it with growth.",
113 "I've seen it. It's rubbish.",
114 "All Bibles are man-made.",
115 "Spock, did you see the looks on their faces?",
116 "Yes, Captain, a sort of vacant contentment.",
117 "Gravitation cannot be held responsible for people falling in love.",
118 "I think Michael is like litmus paper - he's always trying to learn.",
119 "A verbal contract isn't worth the paper it's printed on.",
120 "We shall reach greater and greater platitudes of achievement.",
121 "With molasses you catch flies, with vinegar you catch nobody.",
122 "Lead us in a few words of silent prayer.",
123 "I couldn't remember things until I took that Sam Carnegie course.",
124 "Ninety percent of baseball is half mental.",
125 "jackpot: you may have an unneccessary change record",
126 "One lawyer can steal more than a hundred men with guns.",
127 "One day I woke up and discovered that I was in love with tripe.",
128 "When people are least sure, they are often most dogmatic.",
129 "Nature is very un-American. Nature never hurries.",
130 "We learn from history that we learn nothing from history.",
131 "Flattery is all right -- if you don't inhale.",
132 "Consistency requires you to be as ignorant today as you were a year ago.",
133 "Tell the truth and run.",
134 "Never face facts; if you do, you'll never get up in the morning.",
135 "Life is a garment we continuously alter, but which never seems to fit.",
136 "It is easier to fight for principles than to live up to them.",
137 "Success covers a multitude of blunders.",
138 "Yes, and I feel bad about rendering their useless carci into dogfood...",
139 "You're a creature of the night, Michael. Wait'll Mom hears about this.",
140 "Plastic gun. Ingenious. More coffee, please.",
141 "Silent gratitude isn't very much use to anyone.",
142 "But this one goes to eleven.",
143 "Been through Hell? Whaddya bring back for me?",
144 "I've got some amyls. We could either party later or, like, start his heart.",
145 "Roman Polanski makes his own blood. He's smart -- that's why his movies work.",
146 "The following is not for the weak of heart or Fundamentalists.",
147 "'Course you haven't, you fruit-loop little geek.",
148 "Hi, I'm Professor Alan Ginsburg... But you can call me... Captain Toke.",
149 "Time is money and money can't buy you love and I love your outfit",
150 "Can't you just gesture hypnotically and make him disappear?",
151 "You shouldn't make my toaster angry.",
152 "Everyone is entitled to an *informed* opinion.",
153 "May the forces of evil become confused on the way to your house.",
154 "If it's not loud, it doesn't work!",
155 "Hello again, Peabody here...",
156 "It's the best thing since professional golfers on 'ludes.",
157 "And remember: Evil will always prevail, because Good is dumb.",
158 "We don't have to protect the environment -- the Second Coming is at hand.",
159 "To YOU I'm an atheist; to God, I'm the Loyal Opposition.",
160 "Only the hypocrite is really rotten to the core.",
161 "The sixties were good to you, weren't they?",
162 "You stay here, Audrey -- this is between me and the vegetable!",
163 "You know, we've won awards for this crap.",
164 "Mr. Spock succumbs to a powerful mating urge and nearly kills Captain Kirk.",
165 "Poor man... he was like an employee to me.",
166 "Trust me. I know what I'm doing.",
167 "If truth is beauty, how come no one has their hair done in the library?",
168 "Look! There! Evil!.. pure and simple, total evil from the Eighth Dimension!",
169 "I may be synthetic, but I'm not stupid",
170 "Danger, you haven't seen the last of me!",
171 "When anyone says `theoretically,' they really mean `not really.'",
172 "No problem is so formidable that you can't walk away from it.",
173 "For the man who has everything... Penicillin.",
174 "The way of the world is to praise dead saints and prosecute live ones.",
175 "It's a dog-eat-dog world out there, and I'm wearing Milkbone underware.",
176 "Would I turn on the gas if my pal Mugsy were in there?",
177 "Consequences, Schmonsequences, as long as I'm rich.",
178 "And do you think (fop that I am) that I could be the Scarlet Pumpernickel?",
179 "Kill the Wabbit, Kill the Wabbit, Kill the Wabbit!",
180 "I DO want your money, because god wants your money!",
181 "You show me an American who can keep his mouth shut and I'll eat him.",
182 "There is hopeful symbolism in the fact that flags do not wave in a vacuum.",
183 "Not only is God dead, but just try to find a plumber on weekends.",
184 "Nuclear war would really set back cable.",
185 "You tweachewous miscweant!",
186 "Open Channel D...",
187 "The pyramid is opening!",
188 "The one with the ever-widening hole in it!",
189 "My sense of purpose is gone! I have no idea who I AM!",
190 "You are WRONG, you ol' brass-breasted fascist poop!",
191 "Your mother was a hamster, and your father smelt of elderberries!",
192 "Take that, you hostile sons-of-bitches!",
193 "The voters have spoken, the bastards...",
194 "Be there. Aloha.",
195 "When the going gets weird, the weird turn pro...",
196 "Say yur prayers, yuh flea-pickin' varmint!",
197 "There... I've run rings 'round you logically",
198 "Let's show this prehistoric bitch how we do things downtown!",
199 "Just the facts, Ma'am",
200 "I have five dollars for each of you.",
201 "In the fight between you and the world, back the world.",
202 "Don't worry about the mule. Just load the wagon.",
203 "Being against torture ought to be sort of a bipartisan thing.",
204 "Here comes Mr. Bill's dog.",
205 "I will make no bargains with terrorist hardware.",
206 "Dump the condiments. If we are to be eaten, we don't need to taste good.",
207 "Aww, if you make me cry anymore, you'll fog up my helmet.",
208 "I got everybody to pay up front...then I blew up their planet.",
209 "Atomic batteries to power, turbines to speed.",
210 "I just want to be a good engineer.",
211 "When in doubt, print 'em out.",
212 "We came. We saw. We kicked its ass.",
213 "Laugh while you can, monkey-boy.",
214 "Floggings will continue until morale improves.",
215 "Hey Ivan, check your six.",
216 "Free markets select for winning solutions.",
217 "The urge to destroy is also a creative urge.",
218 "Wish not to seem, but to be, the best.",
219 "Survey says...",
220 "Paul Lynde to block...",
221 "Little else matters than to write good code.",
222 "Stupidity, like virtue, is its own reward",
223 "If a computer can't directly address all the RAM you can use, it's just a toy.",
224 "A dirty mind is a joy forever.",
225 "You can't teach seven foot.",
226 "A car is just a big purse on wheels.",
227 "History is a tool used by politicians to justify their intentions.",
228 "Nine years of ballet, asshole.",
229 "Being against torture ought to be sort of a multipartisan thing.",
230 "Facts are stupid things.",
231 "An ounce of prevention is worth a ton of code.",
232 "Just think of a computer as hardware you can program.",
233 "Everything should be made as simple as possible, but not simpler.",
234 "Card readers? We don't need no stinking card readers.",
235 "Gotcha, you snot-necked weenies!",
236 "Everybody is talking about the weather but nobody does anything about it.",
237 "How many teamsters does it take to screw in a light bulb?",
238 "If you weren't my teacher, I'd think you just deleted all my files.",
239 "The medium is the message.",
240 "The medium is the massage.",
241 "Show me a good loser, and I'll show you a loser.",
242 "It might help if we ran the MBA's out of Washington.",
243 "Love may fail, but courtesy will previal.",
244 "There is no distinctly American criminal class except Congress.",
245 "You'll pay to know what you really think.",
246 "We live, in a very kooky time.",
247 "Pull the wool over your own eyes!",
248 "Our reruns are better than theirs.",
249 "Pay no attention to the man behind the curtain.",
250 "Pay no attention to the man behind the curtain.",
251 "Don't discount flying pigs before you have good air defense.",
252 "In the long run, every program becomes rococo, and then rubble.",
253 "Pok pok pok, P'kok!",
254 "You can't get very far in this world without your dossier being there first.",
255 "Your butt is mine.",
256 "Once they go up, who cares where they come down? That's not my department.",
257 "Imitation is the sincerest form of television.",
258 "The lesser of two evils -- is evil.",
259 "Is this foreplay?",
260 "A mind is a terrible thing to have leaking out your ears.",
261 "Life sucks, but it's better than the alternative.",
262 "Even if you're on the right track, you'll get run over if you just sit there.",
263 "An open mind has but one disadvantage: it collects dirt.",
264 "The geeks shall inherit the earth.",
265 "Beware of programmers carrying screwdrivers.",
266 "Elvis is my copilot.",
267 "Let us condemn to hellfire all those who disagree with us.",
268 "The number of Unix installations has grown to 10, with more expected.",
269 "Engineering without management is art.",
270 "I'm not a god, I was misquoted.",
271 "Psychoanalysis?? I thought this was a nude rap session!!!",
272 "Seed me, Seymour",
273 "Buy land. They've stopped making it.",
274 "Open the pod bay doors, HAL.",
275 "This generation may be the one that will face Armageddon.",
276 "The only way for a reporter to look at a politician is down.",
277 "If the code and the comments disagree, then both are probably wrong.",
278 "May your future be limited only by your dreams.",
279 "Freedom is still the most radical idea of all.",
280 "I never let my schooling get in the way of my education.",
281 "Thank heaven for startups; without them we'd never have any advances.",
282 "Out of register space (ugh)",
283 "'Tis true, 'tis pity, and pity 'tis 'tis true.",
284 "Indecision is the basis of flexibility",
285 "Sometimes insanity is the only alternative",
286 "Old age and treachery will beat youth and skill every time.",
287 "The most important thing in a man is not what he knows, but what he is.",
288 "All we are given is possibilities -- to make ourselves one thing or another.",
289 "From there to here, from here to there, funny things are everywhere.",
290 "When it comes to humility, I'm the greatest.",
291 "Engineering meets art in the parking lot and things explode.",
292 "Never give in. Never give in. Never. Never. Never.",
293 "Never ascribe to malice that which is caused by greed and ignorance.",
294 "I prefer rogues to imbeciles, because they sometimes take a rest.",
295 "Everyone's head is a cheap movie show.",
296 "Were there no women, men might live like gods.",
297 "Intelligence without character is a dangerous thing.",
298 "It's not just a computer -- it's your ass.",
299 "Let me guess, Ed. Pentescostal, right?",
300 "BTW, does Jesus know you flame?",
301 "I've seen the forgeries I've sent out.",
302 "Bite off, dirtball.",
303 "You who hate the Jews so, why did you adopt their religion?",
304 "Faith: not *wanting* to know what is true.",
305 "If you are afraid of loneliness, don't marry.",
306 "In matrimony, to hesitate is sometimes to be saved.",
307 "It will tell us.",
308 "Inquiry is fatal to certainty.",
309 "Cogito ergo I'm right and you're wrong.",
310 "Your stupidity, Allen, is simply not up to par.",
311 "Yours is.",
312 "Jesus saves...but Gretzky gets the rebound!",
313 "Anything created must necessarily be inferior to the essence of the creator.",
314 "Einstein's mother must have been one heck of a physicist.",
315 "Any excuse will serve a tyrant.",
316 "Experience has proved that some people indeed know everything.",
317 "I prefer the blunted cudgels of the followers of the Serpent God.",
318 "my terminal is a lethal teaspoon.",
319 "I am ... a woman ... and ... technically a parasitic uterine growth",
320 "Money is the root of all money.",
321 "...Greg Nowak: `Another flame from greg' - need I say more?",
322 "No. You need to say less.",
323 "Marriage is low down, but you spend the rest of your life paying for it.",
324 "The chain which can be yanked is not the eternal chain.",
325 "Go to Heaven for the climate, Hell for the company.",
326 "Well hello there Charlie Brown, you blockhead.",
327 "Time is an illusion. Lunchtime doubly so.",
328 "Ignorance is the soil in which belief in miracles grows.",
329 "Let every man teach his son, teach his daughter, that labor is honorable.",
330 "I have not the slightest confidence in 'spiritual manifestations.'",
331 "It is hard to overstate the debt that we owe to men and women of genius.",
332 "Joy is wealth and love is the legal tender of the soul.",
333 "The hands that help are better far than the lips that pray.",
334 "Be *excellent* to each other.",
335 "I'm not afraid of dying, I just don't want to be there when it happens.",
336 "The Street finds its own uses for technology.",
337 "What the scientists have in their briefcases is terrifying.",
338 "...a most excellent barbarian ... Genghis Kahn!",
339 "Pull the trigger and you're garbage.",
340 "Oh what wouldn't I give to be spat at in the face...",
341 "If you can't debate me, then there is no way in hell you'll out-insult me.",
342 "You may be wrong here, little one.",
343 "I am, therefore I am.",
344 "It's what you learn after you know it all that counts.",
345 "We want to create puppets that pull their own strings.",
346 "Would this make them Marionettes?",
347 "Love your country but never trust its government.",
348 "Turn on, tune up, rock out.",
349 "Life sucks, but death doesn't put out at all....",
350 "Life, loathe it or ignore it, you can't like it.",
351 "A mere abacus. Mention it not.",
352 "America is a stronger nation for the ACLU's uncompromising effort.",
353 "Luke, I'm yer father, eh. Come over to the dark side, you hoser.",
354 "Don't think; let the machine do it for you!",
355 "It ain't over until it's over.",
356 "If anything can go wrong, it will.",
357 "Yo baby yo baby yo.",
358 "Nuclear war can ruin your whole compile.",
359 "Remember, extremism in the nondefense of moderation is not a virtue.",
360 "What man has done, man can aspire to do.",
361 "Well, it don't make the sun shine, but at least it don't deepen the shit.",
362 "If you can, help others. If you can't, at least don't hurt others.",
363 "Just think, with VLSI we can have 100 ENIACS on a chip!",
364 "Gort, klaatu nikto barada.",
365 "Dale, your address no longer functions. Can you fix it at your end?",
366 "Bill, Your brain no longer functions. Can you fix it at your end?",
367 "Don't drop acid, take it pass-fail!",
368 "I got a question for ya. Ya got a minute?",
369 "Help Mr. Wizard!",
370 "Don't talk to me about disclaimers! I invented disclaimers!",
371 "Cable is not a luxury, since many areas have poor TV reception.",
372 "It's when they say 2 + 2 = 5 that I begin to argue.",
373 "You can have my Unix system when you pry it from my cold, dead fingers.",
374 "Vogons may read you bad poetry, but bogons make you study obsolete RFCs.",
375 "That's just like the episode where Jan loses her glasses!",
376 "Hey, aren't you the string I just threw out of here?",
377 "Hey! Who took the cork off my lunch?!",
378 "Mind if I smoke?",
379 "Mind if I smoke?",
380 "The whole world is about three drinks behind.",
381 "A University without students is like an ointment without a fly.",
382 "He was a modest, good-humored boy. It was Oxford that made him insufferable.",
383 "I am not sure what this is, but an `F' would only dignify it.",
384 "I have to convince you, or at least snow you ...",
385 "If you understand what you're doing, you're not learning anything.",
386 "OK, now let's look at four dimensions on the blackboard.",
387 "Plaese porrf raed.",
388 "Speed is subsittute fo accurancy.",
389 "We demand rigidly defined areas of doubt and uncertainty!",
390 "All snakes who wish to remain in Ireland will please raise their right hands.",
391 "Gee, Toto, I don't think we are in Kansas anymore.",
392 "God gives burdens; also shoulders",
393 "I'm in Pittsburgh. Why am I here?",
394 "You must be from New York.",
395 "Old MacDonald had a . . .",
396 "Eat, drink, and be merry, for tomorrow you may work.",
397 "Life is like a buffet; it's not good but there's plenty of it.",
398 "what's the first thing you say to yourself?",
399 "A power so great, it can only be used for Good or Evil!",
400 "Boy, life takes a long time to live.",
401 "But I don't like Spam!!!!",
402 "Humor is a drug which it's the fashion to abuse.",
403 "If I melt dry ice, can I take a bath without getting wet?",
404 "Right now I'm having amnesia and deja vu at the same time.",
405 "In the abstract, yes, but not in the concrete.",
406 "So will you.",
407 "Elwood, in this world you must be oh so smart or oh so pleasant.",
408 "The only real way to look younger is not to be born so soon.",
409 "There was a boy called Eustace Clarence Scrubb, and he almost deserved it.",
410 "We've taught our boy everything we know, he's fit to be tide.",
411 "I was afraid you would waver under testimony.",
412 "All language designers are arrogant. Goes with the territory...",
413 "Besides, I think [Slackware] sounds better than 'Microsoft,' don't you?",
414 "I'm an idiot.. At least this one [bug] took about 5 minutes to find..",
415 "It's God. No, not Richard Stallman, or Linus Torvalds, but God.",
416 "...[Linux's] capacity to talk via any medium except smoke signals.",
417 "Never make any mistaeks.",
418 "On the Internet, no one knows you're using Windows NT",
419 "sic transit discus mundi",
420 "We all know Linux is great...it does infinite loops in 5 seconds.",
421 "Whip me. Beat me. Make me maintain AIX.",
422 "Who is General Failure and why is he reading my hard disk ?",
423 "World domination. Fast",
424 "I'd love to go out with you, but I have to floss my cat.",
425 "I'd love to go out with you, but I have to stay home and see if I snore.",
426 "I'd love to go out with you, but I never go out on days that end in `Y.'",
427 "I'd love to go out with you, but I want to spend more time with my blender.",
428 "I'd love to go out with you, but I'm attending the opening of my garage door.",
429 "I'd love to go out with you, but I'm having all my plants neutered.",
430 "I'd love to go out with you, but I'm taking punk totem pole carving.",
431 "I'd love to go out with you, but I've been scheduled for a karma transplant.",
432 "I'd love to go out with you, but it's my parakeet's bowling night.",
433 "I'd love to go out with you, but my favorite commercial is on TV.",
434 "I'd love to go out with you, but the last time I went out, I never came back.",
435 "I'd love to go out with you, but the man on television told me to stay tuned.",
436 "OK, you win, I give up. Where did you hide the ship?",
437 "Sure, I put your dog in the microwave. But I feel *better* for doing it.",
438 "... the Mayo Clinic, named after its founder, Dr. Ted Clinic ...",
439 "What happened?",
440 "It's men like him that give the Y chromosome a bad name.",
441 "This is a parson to parson call.",
442 "Whatever the missing mass of the universe is, I hope it's not cockroaches!",
443 "Earth is a great, big funhouse without the fun.",
444 "He flung himself on his horse and rode madly off in all directions.",
445 "I don't mind going nowhere as long as it's an interesting path.",
446 "I found out why my car was humming. It had forgotten the words.",
447 "I only touch base with reality on an as-needed basis!",
448 "If a camel flies, no one laughs if it doesn't get very far.",
449 "It was a virgin forest, a place where the Hand of Man had never set foot.",
450 "To vacillate or not to vacillate, that is the question ... or is it?",
451 "What's the use of a good quotation if you can't change it?",
452 "No self-respecting fish would want to be wrapped in that kind of paper.",
453 "All my life I wanted to be someone; I guess I should have been more specific.",
454 "Apathy is not the problem, it's the solution",
455 "Arguments with furniture are rarely productive.",
456 "He's the kind of man for the times that need the kind of man he is ...",
457 "I didn't know it was impossible when I did it.",
458 "I've seen, I SAY, I've seen better heads on a mug of beer",
459 "If we were meant to fly, we wouldn't keep losing our luggage.",
460 "Maybe we can get together and show off to each other sometimes.",
461 "No one gets too old to learn a new way of being stupid.",
462 "See - the thing is - I'm an absolutist. I mean, kind of ... in a way ...",
463 "That boy's about as sharp as a pound of wet liver",
464 "The Schizophrenic: An Unauthorized Autobiography",
465 "They told me I was gullible ... and I believed them!",
466 "They're unfriendly, which is fortunate, really. They'd be difficult to like.",
467 "I don't know.",
468 "You can't teach people to be lazy - either they have it, or they don't.",
469 "I'm here t'git the man that shot muh paw.",
470 "A radioactive cat has eighteen half-lives.",
471 "An ounce of prevention is worth a pound of purge.",
472 "I think that I think, therefore I think that I am.",
473 "Cogito ergo I'm right and you're wrong.",
474 "Life is too important to take seriously.",
475 "The porcupine with the sharpest quills gets stuck on a tree more often.",
476 "MOKE DAT YIGARETTE",
477 "Cable is not a luxury, since many areas have poor TV reception.",
478 "... gentlemen do not read each other's mail.",
479 "Give me enough medals, and I'll win any war.",
480 "I don't care who does the electing as long as I get to do the nominating.",
481 "I'm not stupid, I'm not expendable, and I'M NOT GOING!",
482 "I'm willing to sacrifice anything for this cause, even other people's lives.",
483 "If the King's English was good enough for Jesus, it's good enough for me!",
484 "Never underestimate the power of a small tactical nuclear weapon.",
485 "Nuclear war would really set back cable.",
486 "legitimate desire of the prisoner to regain his liberty.",
487 "They make a desert and call it peace.",
488 "Those who do not do politics will be done in by politics.",
489 "Light, bearing on the starboard bow.",
490 "Ubi non accusator, ibi non judex.",
491 "355/113 -- Not the famous irrational number PI, but an incredible simulation!",
492 "Anything created must necessarily be inferior to the essence of the creator.",
493 "Einstein's mother must have been one heck of a physicist.",
494 "Consider a spherical bear, in simple harmonic motion...",
495 "One, two, five.",
496 "And he didn't understand me.",
497 "Gentlemen, what we have here is a terrifying example of the reindeer effect.",
498 "If value corrupts then absolute value corrupts absolutely.",
499 "In short, _\bN is Richardian if, and only if, _\bN is not Richardian.",
500 "Irrationality is the square root of all evil",
501 "It's easier said than done.",
502 "Obviously, a major malfunction has occurred.",
503 "This isn't right. This isn't even wrong.",
504 "Our vision is to speed up time, eventually eliminating it.",
505 "The four building blocks of the universe are fire, water, gravel and vinyl.",
506 "The identical is equal to itself, since it is different.",
507 "We don't care. We don't have to. We're the Phone Company.",
508 "What I've done, of course, is total garbage.",
509 "When the going gets tough, the tough get empirical.",
510 "Yeah, but you're taking the universe out of context.",
511 "To hear my character lied about!",
512 "How good, how good does it feel to be free?",
513 "Are birds free from the chains of the sky-way?",
514 "I tot I taw a puddy tat.",
515 "That eye is like this eye",
516 "That definition's just.",
517 "Force is not might but must!",
518 "The nights are rather damp.",
519 "You can never--",
520 "I thought that you said you were 20 years old!",
521 "And you claimed to be very near two meters tall!",
522 "You said you were blonde, but you lied!",
523 "Better head back to Tennessee Jed",
524 "Dreamer! Get your head out of the clouds.",
525 "The Four Corners of the Round Table.",
526 "Nice poem Tom. I have ideas for changes though, why not come over?",
527 "Lines that are parallel meet at Infinity!",
528 "My name is Sue! How do you do?! Now you gonna die!",
529 "No program is perfect,",
530 "Pipe a song about a Lamb!",
531 "Piper, pipe that song again;",
532 "I have answered three questions and that is enough,",
533 "I have answered three questions, and that is enough,",
534 "Today I will be brilliant.",
535 "I'm a doctor, not a mechanic.",
536 "I'm a doctor, not an escalator.",
537 "I'm a doctor, not a bricklayer.",
538 "I'm a doctor, not an engineer.",
539 "I'm a doctor, not a coalminer.",
540 "I'm a surgeon, not a psychiatrist.",
541 "I'm no magician, Spock, just an old country doctor.",
542 "What am I, a doctor or a moonshuttle conductor?",
543 "Just lie down on the floor and keep calm.",
544 "Thou art That...",
545 "The chain which can be yanked is not the eternal chain.",
546 "You can't survive by sucking the juice from a wet mitten.",
547 "Der bestirnte Himmel über mir und das moralische Gesetz in mir",
548 "The starry sky above me, and the Moral Law inside me.",
549 "At least they're ___________\b\b\b\b\b\b\b\b\b\b\bEXPERIENCED incompetents",
550 "But don't you worry, its for a cause -- feeding global corporations' paws.",
551 "but the important thing is that they're not about to admit it.",
552 "Consequences, Schmonsequences, as long as I'm rich.",
553 "Every man has his price. Mine is $3.95.",
554 "No job too big; no fee too big!",
555 "Lookit all them WIRES in there!",
556 "That's not a Porsche, it's a Ferrari.",
557 "I recommend this candidate with no qualifications whatsoever.",
558 "The amount of mathematics she knows will surprise you.",
559 "I simply can't say enough good things about him.",
560 "I am pleased to say that this candidate is a former colleague of mine.",
561 "You won't find many people like her.",
562 "I cannot reccommend him too highly.",
563 "Her input was always critical.",
564 "I have no doubt about his capability to do good work.",
565 "She is quite uniform in her approach to any function you may assign her.",
566 "You will be fortunate if you can get him to work for you.",
567 "Success will never spoil him.",
568 "One usually comes away from him with a good feeling.",
569 "He should go far.",
570 "He will take full advantage of his staff.",
571 "Who is General Failure and why is he reading my hard disk?",
572 "And I don't like doing silly things (except on purpose).",
573 "Let's call it an accidental feature. :-)",
574 "It is easier to port a shell than a shell script.",
575 "The road to hell is paved with melting snowballs.",
576 "Now we'll have to kill you.",
577 "I am ecstatic that some moron re-invented a 1995 windows fuckup.",
578 "HAHAHAHAHA!! That's good, I like it..",
579 "Um, thanks, they make us say that.",
580 "I have a bone to pick, and a few to break.",
581 "So, will the Andover party have a cash bar?",
582 "No, there's free beer.",
583 "Uh-oh, Stallman's gonna be pissed...",
584 "What are we going to do tonight, Bill?",
585 "Same thing we do every night Steve, try to take over the world!",
586 "This is a job for BOB VIOLENCE and SCUM, the INCREDIBLY STUPID MUTANT DOG.",
589 #define BLPATH "/tmp/binlog-test"
590 struct test_binlog {
591 char *path;
592 char *name;
593 uint msize, fsize;
595 static struct test_binlog test[] = {
596 { "/tmp/binlog-test", "All in memory", 10000000, 1000000 },
597 { "/tmp/binlog-test", "All on disk", 0, 1000000 },
598 { "/tmp/binlog-test", "Some on disk", 4096, 1000000 },
599 { "/tmp/binlog-test", "not enough space", 3, 3 },
602 static void print_test_params(struct test_binlog *t)
604 if (!t)
605 return;
606 printf(" path: %s\n name: %s\n msize: %u\n fsize: %u\n\n",
607 t->path, t->name, t->msize, t->fsize);
610 static void fail(const char *msg, struct test_binlog *t)
612 t_fail("%s", msg);
613 print_test_params(t);
616 static int test_binlog(struct test_binlog *t, binlog *bl)
618 size_t ok = 0;
619 uint i;
621 for (i = 0; i < ARRAY_SIZE(msg_list); i++) {
622 int result;
623 uint msg_len;
625 msg_len = strlen(msg_list[i]) + 1;
627 result = binlog_add(bl, msg_list[i], msg_len);
628 if (msg_len > t->msize && msg_len > t->fsize && result == BINLOG_ENOSPC) {
629 ok++;
630 continue;
634 if (!binlog_has_entries(bl))
635 return ok - ARRAY_SIZE(msg_list);
637 ok = 0;
638 for (i = 0; i < ARRAY_SIZE(msg_list); i++) {
639 char *str = NULL;
640 int result;
641 uint len, msg_len;
643 msg_len = strlen(msg_list[i]) + 1;
644 result = binlog_read(bl, (void **)&str, &len);
645 if (result == BINLOG_EMPTY) {
646 printf("binlog claims it's empty when just added to\n");
647 continue;
650 if (len != msg_len) {
651 printf("bad length returned. Expected %u, got %u\n", msg_len, len);
654 if (!str) {
655 printf("got '%p' back\n", str);
656 } else if (strcmp(str, msg_list[i])) {
657 printf("strings returned don't match.\n");
659 else
660 ok++;
662 free(str);
665 for (i = 0; i < ARRAY_SIZE(msg_list); i++) {
666 binlog_add(bl, msg_list[i], strlen(msg_list[i]) + 1);
669 binlog_wipe(bl, BINLOG_UNLINK);
670 if (binlog_has_entries(bl))
671 fail("Wiped binlog claims to have entries", NULL);
672 else
673 t_pass("Wiped binlog has no entries");
674 binlog_invalidate(bl);
675 if (binlog_is_valid(bl))
676 fail("invalidated binlog claims to be valid", NULL);
677 else
678 t_pass("invalidated binlog is invalid");
680 if (ok == ARRAY_SIZE(msg_list))
681 return 0;
683 return 1;
687 * Test the binlog api for leaks. This requires valgrind
689 static void test_binlog_leakage(void)
691 int i = 0, expect_end = 0;
692 struct binlog *bl;
693 uint len;
694 char *p;
695 #define LARGE_MSIZE (5 << 20)
696 #define LARGE_FSIZE (10 << 20)
697 #define LARGE_PATH "/tmp/large-binlog"
698 bl = binlog_create(LARGE_PATH, LARGE_MSIZE, LARGE_FSIZE, BINLOG_UNLINK);
699 while (binlog_size(bl) < LARGE_MSIZE) {
700 i = (i + 1) % ARRAY_SIZE(msg_list);
701 if (binlog_add(bl, msg_list[i], strlen(msg_list[i])) < 0) {
702 printf("binlog_add() failed\n");
703 break;
706 binlog_add(bl, "LAST", sizeof("LAST"));
707 while (!binlog_read(bl, (void **)&p, &len)) {
708 if (expect_end || (len == sizeof("LAST") && !strcmp(p, "LAST")))
709 expect_end++;
710 free(p);
712 if (expect_end == 1)
713 t_pass("Transitioning from memory to file");
714 else
715 t_fail("Transitioning from memory to file");
717 binlog_destroy(bl, BINLOG_UNLINK);
720 int main(int argc, char **argv)
722 uint i;
724 t_set_colors(0);
725 t_start("binlog tests");
726 if (isatty(fileno(stdout))) {
727 green = CLR_GREEN;
728 red = CLR_RED;
729 reset = CLR_RESET;
730 } else {
731 green = red = reset = "";
734 for (i = 0; i < ARRAY_SIZE(test); i++) {
735 struct test_binlog *t = &test[i];
736 struct binlog *bl;
737 struct stat st;
739 bl = binlog_create(t->path, t->msize, t->fsize, BINLOG_UNLINK);
740 if (!bl) {
741 fail("Failed to create binlog", t);
742 continue;
745 if (!test_binlog(t, bl)) {
746 t_pass(t->name);
747 } else {
748 fail(t->name, t);
750 binlog_destroy(bl, 1);
752 if (stat(t->path, &st) < 0) {
753 t_pass("binlog_destroy(bl, 1) removes the fully read file");
754 } else {
755 fail("binlog_destroy(bl, 1) fails to remove the fully read file", t);
757 unlink(t->path);
760 test_binlog_leakage();
761 t_end();
762 return 0;