blob: 04fa5ef97a52c6179c3ecdcd121c7d7dee1eb070 [file] [log] [blame]
Mark Whitley40bfc762000-07-24 22:36:06 +00001Busybox Style Guide
2===================
3
4This document describes the coding style conventions used in Busybox. If you
5add a new file to Busybox or are editing an existing file, please format your
6code according to this style. If you are the maintainer of a file that does
7not follow these guidelines, please -- at your own convenience -- modify the
8file(s) you maintain to bring them into conformance with this style guide.
9Please note that this is a low priority task.
10
11To help you format the whitespace of your programs, an ".indent.pro" file is
12included in the main Busybox source directory that contains option flags to
13format code as per this style guide. This way you can run GNU indent on your
14files by typing 'indent myfile.c myfile.h' and it will magically apply all the
15right formatting rules to your file. Please _do_not_ run this on all the files
16in the directory, just your own.
17
Mark Whitley2368a382000-08-22 00:20:21 +000018
Mark Whitleyd58ff872000-11-22 19:25:39 +000019
Mark Whitley40bfc762000-07-24 22:36:06 +000020Declaration Order
21-----------------
22
23Here is the order in which code should be laid out in a file:
24
Mark Whitley9028e2c2000-11-17 21:28:39 +000025 - commented program name and one-line description
Mark Whitley40bfc762000-07-24 22:36:06 +000026 - commented author name and email address(es)
27 - commented GPL boilerplate
Mark Whitley9028e2c2000-11-17 21:28:39 +000028 - commented longer description / notes for the program (if needed)
Mark Whitley40bfc762000-07-24 22:36:06 +000029 - #includes and #defines
Mark Whitley9028e2c2000-11-17 21:28:39 +000030 - const and global variables
Mark Whitley40bfc762000-07-24 22:36:06 +000031 - function declarations (if necessary)
32 - function implementations
33
Mark Whitley2368a382000-08-22 00:20:21 +000034
Mark Whitleyd58ff872000-11-22 19:25:39 +000035
36Whitespace and Formatting
37-------------------------
Mark Whitley40bfc762000-07-24 22:36:06 +000038
Mark Whitley2368a382000-08-22 00:20:21 +000039This is everybody's favorite flame topic so let's get it out of the way right
40up front.
41
42
Mark Whitley9028e2c2000-11-17 21:28:39 +000043Tabs vs. Spaces in Line Indentation
Mark Whitleyd58ff872000-11-22 19:25:39 +000044~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Whitley2368a382000-08-22 00:20:21 +000045
46The preference in Busybox is to indent lines with tabs. Do not indent lines
47with spaces and do not indents lines using a mixture of tabs and spaces. (The
48indentation style in the Apache and Postfix source does this sort of thing:
49\s\s\s\sif (expr) {\n\tstmt; --ick.) The only exception to this rule is
50multi-line comments that use an asterisk at the beginning of each line, i.e.:
Mark Whitley40bfc762000-07-24 22:36:06 +000051
52 /t/*
53 /t * This is a block comment.
54 /t * Note that it has multiple lines
55 /t * and that the beginning of each line has a tab plus a space
56 /t * except for the opening '/*' line where the slash
57 /t * is used instead of a space.
58 /t */
59
60Furthermore, The preference is that tabs be set to display at four spaces
61wide, but the beauty of using only tabs (and not spaces) at the beginning of
Mark Whitley9028e2c2000-11-17 21:28:39 +000062lines is that you can set your editor to display tabs at *whatever* number of
Mark Whitley40bfc762000-07-24 22:36:06 +000063spaces is desired and the code will still look fine.
64
65
Mark Whitley2368a382000-08-22 00:20:21 +000066Operator Spacing
67~~~~~~~~~~~~~~~~
68
69Put spaces between terms and operators. Example:
Mark Whitley40bfc762000-07-24 22:36:06 +000070
71 Don't do this:
72
73 for(i=0;i<num_items;i++){
74
75 Do this instead:
76
77 for (i = 0; i < num_items; i++) {
78
79 While it extends the line a bit longer, the spaced version is more
80 readable. An allowable exception to this rule is the situation where
81 excluding the spacing makes it more obvious that we are dealing with a
Mark Whitley9028e2c2000-11-17 21:28:39 +000082 single term (even if it is a compound term) such as:
Mark Whitley40bfc762000-07-24 22:36:06 +000083
84 if (str[idx] == '/' && str[idx-1] != '\\')
85
86 or
87
88 if ((argc-1) - (optind+1) > 0)
89
90
Mark Whitley2368a382000-08-22 00:20:21 +000091Bracket Spacing
92~~~~~~~~~~~~~~~
93
94If an opening bracket starts a function, it should be on the
Mark Whitley9028e2c2000-11-17 21:28:39 +000095next line with no spacing before it. However, if a bracket follows an opening
Mark Whitley40bfc762000-07-24 22:36:06 +000096control block, it should be on the same line with a single space (not a tab)
Mark Whitley9028e2c2000-11-17 21:28:39 +000097between it and the opening control block statement. Examples:
Mark Whitley40bfc762000-07-24 22:36:06 +000098
99 Don't do this:
100
Mark Whitley9028e2c2000-11-17 21:28:39 +0000101 while (!done)
102 {
103
104 do
105 {
106
107 Don't do this either:
108
Mark Whitley40bfc762000-07-24 22:36:06 +0000109 while (!done){
Mark Whitley925edb82001-02-03 00:20:14 +0000110
Mark Whitley40bfc762000-07-24 22:36:06 +0000111 do{
112
Mark Whitley3680c582000-12-20 22:35:12 +0000113 And for heaven's sake, don't do this:
114
115 while (!done)
116 {
Mark Whitley925edb82001-02-03 00:20:14 +0000117
Mark Whitley3680c582000-12-20 22:35:12 +0000118 do
119 {
120
Mark Whitley40bfc762000-07-24 22:36:06 +0000121 Do this instead:
122
123 while (!done) {
Mark Whitley925edb82001-02-03 00:20:14 +0000124
Mark Whitley40bfc762000-07-24 22:36:06 +0000125 do {
126
Mark Whitley2368a382000-08-22 00:20:21 +0000127
Mark Whitley925edb82001-02-03 00:20:14 +0000128Spacing around Parentheses
129~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Whitley2368a382000-08-22 00:20:21 +0000130
131Put a space between C keywords and left parens, but not between
132function names and the left paren that starts it's parameter list (whether it
133is being declared or called). Examples:
134
135 Don't do this:
136
137 while(foo) {
138 for(i = 0; i < n; i++) {
139
140 Do this instead:
141
142 while (foo) {
143 for (i = 0; i < n; i++) {
144
Mark Whitley9028e2c2000-11-17 21:28:39 +0000145 But do functions like this:
Mark Whitley2368a382000-08-22 00:20:21 +0000146
147 static int my_func(int foo, char bar)
148 ...
149 baz = my_func(1, 2);
150
Mark Whitley925edb82001-02-03 00:20:14 +0000151Also, don't put a space between the left paren and the first term, nor between
152the last arg and the right paren.
153
154 Don't do this:
155
156 if ( x < 1 )
157 strcmp( thisstr, thatstr )
158
159 Do this instead:
160
161 if (x < 1)
162 strcmp(thisstr, thatstr)
163
Mark Whitley2368a382000-08-22 00:20:21 +0000164
165Cuddled Elses
166~~~~~~~~~~~~~
167
Mark Whitley9028e2c2000-11-17 21:28:39 +0000168Also, please "cuddle" your else statements by putting the else keyword on the
169same line after the right bracket that closes an 'if' statement.
Mark Whitley40bfc762000-07-24 22:36:06 +0000170
171 Don't do this:
172
173 if (foo) {
174 stmt;
175 }
176 else {
177 stmt;
178 }
179
180 Do this instead:
181
182 if (foo) {
183 stmt;
184 } else {
185 stmt;
186 }
187
Mark Whitley9028e2c2000-11-17 21:28:39 +0000188The exception to this rule is if you want to include a comment before the else
189block. Example:
190
191 if (foo) {
192 stmts...
193 }
194 /* otherwise, we're just kidding ourselves, so re-frob the input */
195 else {
196 other_stmts...
197 }
198
Mark Whitley40bfc762000-07-24 22:36:06 +0000199
Mark Whitleyd58ff872000-11-22 19:25:39 +0000200
Mark Whitley3680c582000-12-20 22:35:12 +0000201
Mark Whitley40bfc762000-07-24 22:36:06 +0000202Variable and Function Names
203---------------------------
204
205Use the K&R style with names in all lower-case and underscores occasionally
Mark Whitley9028e2c2000-11-17 21:28:39 +0000206used to separate words (e.g., "variable_name" and "numchars" are both
Mark Whitley40bfc762000-07-24 22:36:06 +0000207acceptable). Using underscores makes variable and function names more readable
208because it looks like whitespace; using lower-case is easy on the eyes.
209
Mark Whitley3680c582000-12-20 22:35:12 +0000210 Frowned upon:
211
212 hitList
213 TotalChars
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000214 szFileName
215 pf_Nfol_TriState
Mark Whitley3680c582000-12-20 22:35:12 +0000216
217 Preferred:
218
219 hit_list
220 total_chars
221 file_name
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000222 sensible_name
Mark Whitley3680c582000-12-20 22:35:12 +0000223
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000224Exceptions:
225
226 - Enums, macros, and constant variables should all be in upper-case with
227 words optionally seperatedy by underscores (i.e. FIFOTYPE, ISBLKDEV()).
228
229 - Nobody is going to get mad at you for using 'pvar' as the name of a
230 variable that is a pointer to 'var'.
Mark Whitley3680c582000-12-20 22:35:12 +0000231
Mark Whitley40bfc762000-07-24 22:36:06 +0000232Note: The Busybox codebase is very much a mixture of code gathered from a
Mark Whitley9028e2c2000-11-17 21:28:39 +0000233variety of sources. This explains why the current codebase contains such a
234hodge-podge of different naming styles (Java, Pascal, K&R, just-plain-weird,
Mark Whitley40bfc762000-07-24 22:36:06 +0000235etc.). The K&R guideline explained above should therefore be used on new files
236that are added to the repository. Furthermore, the maintainer of an existing
Mark Whitley3680c582000-12-20 22:35:12 +0000237file that uses alternate naming conventions should -- at his own convenience
238-- convert those names over to K&R style; converting variable names is a very
239low priority task. Perhaps in the future we will include some magical Perl
240script that can go through and convert variable names, left as an exercise for
241the reader for now.
Mark Whitley40bfc762000-07-24 22:36:06 +0000242
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000243For the time being, if you want to do a search-and-replace of a variable name
244in different files, do the following in the busybox directory:
245
246 $ perl -pi -e 's/\bOldVar\b/new_var/g' *.[ch]
247
Mark Whitley40bfc762000-07-24 22:36:06 +0000248
Mark Whitley40bfc762000-07-24 22:36:06 +0000249
Mark Whitleyd58ff872000-11-22 19:25:39 +0000250Avoid The Preprocessor
251----------------------
Mark Whitley40bfc762000-07-24 22:36:06 +0000252
Mark Whitleyd58ff872000-11-22 19:25:39 +0000253At best, the preprocessor is a necessary evil, helping us account for platform
254and architecture differences. Using the preprocessor unnecessarily is just
255plain evil.
Mark Whitley2368a382000-08-22 00:20:21 +0000256
Mark Whitley40bfc762000-07-24 22:36:06 +0000257
Mark Whitleyd58ff872000-11-22 19:25:39 +0000258The Folly of #define
259~~~~~~~~~~~~~~~~~~~~
Mark Whitley40bfc762000-07-24 22:36:06 +0000260
Mark Whitleyd58ff872000-11-22 19:25:39 +0000261Use 'const <type> var' for declaring constants.
Mark Whitley40bfc762000-07-24 22:36:06 +0000262
263 Don't do this:
264
Mark Whitleyd58ff872000-11-22 19:25:39 +0000265 #define var 80
266
267 Do this instead, when the variable is in a header file and will be used in
268 several source files:
269
270 const int var = 80;
271
272 Or do this when the variable is used only in a single source file:
273
274 static const int var = 80;
275
276Declaring variables as '[static] const' gives variables an actual type and
277makes the compiler do type checking for you; the preprocessor does _no_ type
278checking whatsoever, making it much more error prone. Declaring variables with
279'[static] const' also makes debugging programs much easier since the value of
280the variable can be easily queried and displayed.
281
282
283The Folly of Macros
284~~~~~~~~~~~~~~~~~~~
285
286Use 'static inline' instead of a macro.
287
288 Don't do this:
289
290 #define mini_func(param1, param2) (param1 << param2)
Mark Whitley40bfc762000-07-24 22:36:06 +0000291
292 Do this instead:
293
Mark Whitleyd58ff872000-11-22 19:25:39 +0000294 static inline int mini_func(int param1, param2)
Mark Whitley40bfc762000-07-24 22:36:06 +0000295 {
Mark Whitleyd58ff872000-11-22 19:25:39 +0000296 return (param1 << param2);
297 }
Mark Whitley40bfc762000-07-24 22:36:06 +0000298
Mark Whitleyd58ff872000-11-22 19:25:39 +0000299Static inline functions are greatly preferred over macros. They provide type
300safety, have no length limitations, no formatting limitations, and under gcc
301they are as cheap as macros. Besides, really long macros with backslashes at
302the end of each line are ugly as sin.
303
304
305The Folly of #ifdef
306~~~~~~~~~~~~~~~~~~~
307
308Code cluttered with ifdefs is difficult to read and maintain. Don't do it.
309Instead, put your ifdefs in a header, and conditionally define 'static inline'
310functions, (or *maybe* macros), which are used in the code.
311
312 Don't do this:
313
314 ret = my_func(bar, baz);
315 if (!ret)
316 return -1;
317 #ifdef BB_FEATURE_FUNKY
318 maybe_do_funky_stuff(bar, baz);
319 #endif
320
321 Do this instead:
322
323 (in .h header file)
324
Mark Whitleyd238a7b2001-02-09 00:28:59 +0000325 #ifdef BB_FEATURE_FUNKY
326 static inline void maybe_do_funky_stuff (int bar, int baz)
327 {
328 /* lotsa code in here */
329 }
330 #else
Mark Whitleyd58ff872000-11-22 19:25:39 +0000331 static inline void maybe_do_funky_stuff (int bar, int baz) {}
332 #endif
333
334 (in the .c source file)
335
336 ret = my_func(bar, baz);
337 if (!ret)
338 return -1;
339 maybe_do_funky_stuff(bar, baz);
340
341The great thing about this approach is that the compiler will optimize away
Mark Whitleyd238a7b2001-02-09 00:28:59 +0000342the "no-op" case (the empty function) when the feature is turned off.
Mark Whitleyd58ff872000-11-22 19:25:39 +0000343
344Note also the use of the word 'maybe' in the function name to indicate
345conditional execution.
346
347
348
349Notes on Strings
350----------------
351
352Strings in C can get a little thorny. Here's some guidelines for dealing with
353strings in Busybox. (There is surely more that could be added to this
354section.)
355
356
357String Files
358~~~~~~~~~~~~
359
360Put all help/usage messages in usage.c. Put other strings in messages.c.
361Putting these strings into their own file is a calculated decision designed to
362confine spelling errors to a single place and aid internationalization
363efforts, if needed. (Side Note: we might want to use a single file - maybe
364called 'strings.c' - instead of two, food for thought).
365
366
367Testing String Equivalence
368~~~~~~~~~~~~~~~~~~~~~~~~~~
369
370There's a right way and a wrong way to test for sting equivalence with
371strcmp():
372
373 The wrong way:
374
375 if (!strcmp(string, "foo")) {
376 ...
377
378 The right way:
379
380 if (strcmp(string, "foo") == 0){
381 ...
382
383The use of the "equals" (==) operator in the latter example makes it much more
384obvious that you are testing for equivalence. The former example with the
385"not" (!) operator makes it look like you are testing for an error. In a more
386perfect world, we would have a streq() function in the string library, but
387that ain't the world we're living in.
388
389
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000390Avoid Dangerous String Functions
391~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
392
393Unfortunately, the way C handles strings makes them prone to overruns when
394certain library functions are (mis)used. The following table offers a summary
395of some of the more notorious troublemakers:
396
397function overflows preferred
398----------------------------------------
399strcpy dest string strncpy
400strcat dest string strncat
401gets string it gets fgets
402getwd buf string getcwd
403[v]sprintf str buffer [v]snprintf
404realpath path buffer use with pathconf
405[vf]scanf its arguments just avoid it
406
407
408The above is by no means a complete list. Be careful out there.
409
410
411
412Avoid Big Static Buffers
413------------------------
414
415First, some background to put this discussion in context: Static buffers look
416like this in code:
417
418 /* in a .c file outside any functions */
419 static char *buffer[BUFSIZ]; /* happily used by any function in this file,
420 but ick! big! */
421
422The problem with these is that any time any busybox app is run, you pay a
423memory penalty for this buffer, even if the applet that uses said buffer is
424not run. This can be fixed, thusly:
425
Eric Andersend35c2152001-01-25 23:49:09 +0000426 static char *buffer;
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000427 ...
428 other_func()
429 {
430 strcpy(buffer, lotsa_chars); /* happily uses global *buffer */
431 ...
432 foo_main()
433 {
434 buffer = xmalloc(sizeof(char)*BUFSIZ);
435 ...
436
437However, this approach trades bss segment for text segment. Rather than
438mallocing the buffers (and thus growing the text size), buffers can be
439declared on the stack in the *_main() function and made available globally by
440assigning them to a global pointer thusly:
441
Eric Andersend35c2152001-01-25 23:49:09 +0000442 static char *pbuffer;
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000443 ...
444 other_func()
445 {
446 strcpy(pbuffer, lotsa_chars); /* happily uses global *pbuffer */
447 ...
448 foo_main()
449 {
450 char *buffer[BUFSIZ]; /* declared locally, on stack */
451 pbuffer = buffer; /* but available globally */
452 ...
453
Eric Andersend35c2152001-01-25 23:49:09 +0000454This last approach has some advantages (low code size, space not used until
455it's needed), but can be a problem in some low resource machines that have
Mark Whitleyd238a7b2001-02-09 00:28:59 +0000456very limited stack space (e.g., uCLinux).
457
458A macro is declared in busybox.h that implements compile-time selection
459between xmalloc() and stack creation, so you can code the line in question as
460
Eric Andersend35c2152001-01-25 23:49:09 +0000461 RESERVE_BB_BUFFER(buffer, BUFSIZ);
Mark Whitleyd238a7b2001-02-09 00:28:59 +0000462
463and the right thing will happen, based on your configuration.
Mark Whitleya5b55ca2001-01-24 00:18:13 +0000464
465
Mark Whitleyd58ff872000-11-22 19:25:39 +0000466
467Miscellaneous Coding Guidelines
468-------------------------------
469
470The following are important items that don't fit into any of the above
471sections.
472
473
474Model Busybox Applets After GNU Counterparts
475~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
476
477When in doubt about the proper behavior of a Busybox program (output,
478formatting, options, etc.), model it after the equivalent GNU program.
479Doesn't matter how that program behaves on some other flavor of *NIX; doesn't
480matter what the POSIX standard says or doesn't say, just model Busybox
481programs after their GNU counterparts and nobody has to get hurt.
482
483The only time we deviate from emulating the GNU behavior is when:
484
485 - We are deliberately not supporting a feature (such as a command line
486 switch)
487 - Emulating the GNU behavior is prohibitively expensive (lots more code
488 would be required, lots more memory would be used, etc.)
Eric Andersen07309432000-11-29 22:12:19 +0000489 - The difference is minor or cosmetic
Mark Whitleyd58ff872000-11-22 19:25:39 +0000490
491A note on the 'cosmetic' case: Output differences might be considered
492cosmetic, but if the output is significant enough to break other scripts that
493use the output, it should really be fixed.
494
495
496Scope
497~~~~~
498
499If a const variable is used only in a single source file, put it in the source
500file and not in a header file. Likewise, if a const variable is used in only
501one function, do not make it global to the file. Instead, declare it inside
Eric Andersen07309432000-11-29 22:12:19 +0000502the function body. Bottom line: Make a conscious effort to limit declarations
Mark Whitleyd58ff872000-11-22 19:25:39 +0000503to the smallest scope possible.
504
505Inside applet files, all functions should be declared static so as to keep the
506global name space clean. The only exception to this rule is the "applet_main"
507function which must be declared extern.
508
509If you write a function that performs a task that could be useful outside the
510immediate file, turn it into a general-purpose function with no ties to any
511applet and put it in the utility.c file instead.
512
513
514Brackets Are Your Friends
515~~~~~~~~~~~~~~~~~~~~~~~~~
516
517Please use brackets on all if and else statements, even if it is only one
518line. Example:
Mark Whitley40bfc762000-07-24 22:36:06 +0000519
520 Don't do this:
521
522 if (foo)
Mark Whitley3680c582000-12-20 22:35:12 +0000523 stmt1;
524 stmt2
525 stmt3;
Mark Whitley40bfc762000-07-24 22:36:06 +0000526
527 Do this instead:
528
529 if (foo) {
Mark Whitley3680c582000-12-20 22:35:12 +0000530 stmt1;
Mark Whitley40bfc762000-07-24 22:36:06 +0000531 }
Mark Whitley3680c582000-12-20 22:35:12 +0000532 stmt2
533 stmt3;
Mark Whitley40bfc762000-07-24 22:36:06 +0000534
Mark Whitleyd58ff872000-11-22 19:25:39 +0000535The "bracketless" approach is error prone because someday you might add a line
536like this:
Mark Whitley40bfc762000-07-24 22:36:06 +0000537
538 if (foo)
Mark Whitley3680c582000-12-20 22:35:12 +0000539 stmt1;
Mark Whitley40bfc762000-07-24 22:36:06 +0000540 new_line();
Mark Whitley3680c582000-12-20 22:35:12 +0000541 stmt2
542 stmt3;
Mark Whitley40bfc762000-07-24 22:36:06 +0000543
Mark Whitleyd58ff872000-11-22 19:25:39 +0000544And the resulting behavior of your program would totally bewilder you. (Don't
545laugh, it happens to us all.) Remember folks, this is C, not Python.
546
547
548Function Declarations
549~~~~~~~~~~~~~~~~~~~~~
550
551Do not use old-style function declarations that declare variable types between
552the parameter list and opening bracket. Example:
553
554 Don't do this:
555
556 int foo(parm1, parm2)
557 char parm1;
558 float parm2;
559 {
560 ....
561
562 Do this instead:
563
564 int foo(char parm1, float parm2)
565 {
566 ....
567
568The only time you would ever need to use the old declaration syntax is to
Eric Andersen07309432000-11-29 22:12:19 +0000569support ancient, antediluvian compilers. To our good fortune, we have access
Mark Whitleyd58ff872000-11-22 19:25:39 +0000570to more modern compilers and the old declaration syntax is neither necessary
571nor desired.
572
Mark Whitley3680c582000-12-20 22:35:12 +0000573
574Emphasizing Logical Blocks
575~~~~~~~~~~~~~~~~~~~~~~~~~~
576
577Organization and readability are improved by putting extra newlines around
578blocks of code that perform a single task. These are typically blocks that
579begin with a C keyword, but not always.
580
581Furthermore, you should put a single comment (not necessarily one line, just
582one comment) before the block, rather than commenting each and every line.
583There is an optimal ammount of commenting that a program can have; you can
584comment too much as well as too little.
585
586A picture is really worth a thousand words here, so here is an example that
587illustrates emphasizing logical blocks:
588
589 while (line = get_line_from_file(fp)) {
590
591 /* eat the newline, if any */
592 if (line[strlen(line)-1] == '\n') {
593 line[strlen(line)-1] = '\0';
594 }
595
596 /* ignore blank lines */
597 if (strlen(file_to_act_on) == 0) {
598 continue;
599 }
600
601 /* if the search string is in this line, print it,
602 * unless we were told to be quiet */
603 if (strstr(line, search) && !be_quiet) {
604 puts(line);
605 }
606
607 /* clean up */
608 free(line);
609 }
Mark Whitley925edb82001-02-03 00:20:14 +0000610
611
612Testing Guidelines
613~~~~~~~~~~~~~~~~~~
614
615It's considered good form to test your new feature before you submit a patch
616to the mailing list, and especially before you commit a change to CVS. Here
617are some guildlines on testing your changes.
618
Mark Whitleyd238a7b2001-02-09 00:28:59 +0000619 - Always test busybox applets against GNU counterparts and make sure the
620 behavior / output is identical between the two.
Mark Whitley925edb82001-02-03 00:20:14 +0000621
622 - Try several different permutations and combinations of the features you're
623 adding and make sure they all work. (Make sure one feature does not
624 interfere with another, etc.)
625
626 - Make sure you test compiling against the source both with the feature
627 turned on and turned off in Config.h and make sure busybox compiles cleanly
628 both ways.
629