Re: TestBed extensions

2008-11-09 Thread Alex Rousskov
On Fri, 2008-11-07 at 13:55 +1300, Amos Jeffries wrote:

> > I will dig out a script that fixes file preamble for all source files.
> > We can apply that once the layout has been fixed.
> 
> Ah excellent. I was contemplating a long manual sweep. But scripts may be
> better. If you can send it my way I'll see about integrating it after the
> next SourceFormat. If its a clean conversion I don't think it matters when
> its run.

The Perl script is attached. It works well for several Factory projects.
I am sure manual labor will be required to standardize all Squid
sources. It gets much easier after the first round though.

The script takes three parameters: the name of the package (e.g.,
"Squid"), the name of the "prefix file" that contains the boilerplate,
and the source file name. The script tries to find the right place to
insert header guards, calculates the right guards in calcGuard(), and
replaces the current file prefix with a standard boilerplate. 

IIRC, the logic for prefix identification is to skip all lines until a
#ifndef guard or #pragma. The script also checks that all header guards
are unique. You will need to adjust calcGuard() to match your rules.

Feel free to modify and add to Squid distribution tools, of course. 


I do not want to fight over the boilerplate, but I would love to see the
current inconsistent and long text in every source file to be replaced
with something exact and concise like

/* This file is a part of Squid Caching Proxy software :: www.squid-cache.org */

or

/* This file is a part of Squid Caching Proxy software, licensed under the
 * terms of The GNU General Public License :: http://www.squid-cache.org/ */


The debugging section that appears in many sources should probably be
moved from informal comments into something like

/* default debugging section for this source file */
static const int dbgSection = 53;

HTH,

Alex.



prefix-sources.pl
Description: Perl program


Re: TestBed extensions

2008-11-06 Thread Amos Jeffries
> On Sun, 2008-11-02 at 16:39 +1300, Amos Jeffries wrote:
>> I'm contemplating a piece of automation to help manage the more complex
>> testbed layers.
>>
>> A piece of code to recursively scan the code files and pull out the
>> unique dependency chains of nested #if...#endif.
>> Reducing the entire codebase to its preprocessor code and performing
>> some of the minor actions as it goes.
>>
>>  From the chain output its relatively easy to manually or otherwise
>> construct the minimal graphs of tests needed to cover all compile paths.
>>
>> To work cleanly it would require a standardization of the .h safety
>> wrapper defines used in squid sources. This only applies to headers
>> bundled with squid and does not affect anything else operationally.
>>
>>
>>  Proposed wrapper define format 
>>
>> #ifndef SQUID_PATH_FILENAME_H
>> #define SQUID_PATH_FILENAME_H
>>...
>> #endif /* SQUID_PATH_FILENAME_H */
>>
>> so that each .h file was wrapped with a define indicating its current
>> location in the sources.
>>
>> Not new, most files do this already with much variation on exact texts,
>> some do not. Just proposing it be formally adopted.
>
> Do we want SRC in PATH? If we are moving every source file to src/ then
> probably not, right?

I'm undecided, but leaning toward eliding it.

>
> Do we want underscores between path components? For example,
>   ADAPTATIONICAP or ADAPTATION_ICAP for src/adaptation/icap/
>   FSDISKD or FS_DISKD for src/fs/diskd/
>
> Adding underscores is more readable but I do not have a strong
> preference so just pick whatever you think works best.

I'm preferring the underscores.

>
> I will dig out a script that fixes file preamble for all source files.
> We can apply that once the layout has been fixed.

Ah excellent. I was contemplating a long manual sweep. But scripts may be
better. If you can send it my way I'll see about integrating it after the
next SourceFormat. If its a clean conversion I don't think it matters when
its run.

Amos



Re: TestBed extensions

2008-11-06 Thread Alex Rousskov
On Sun, 2008-11-02 at 16:39 +1300, Amos Jeffries wrote:
> I'm contemplating a piece of automation to help manage the more complex 
> testbed layers.
> 
> A piece of code to recursively scan the code files and pull out the 
> unique dependency chains of nested #if...#endif.
> Reducing the entire codebase to its preprocessor code and performing 
> some of the minor actions as it goes.
> 
>  From the chain output its relatively easy to manually or otherwise 
> construct the minimal graphs of tests needed to cover all compile paths.
> 
> To work cleanly it would require a standardization of the .h safety 
> wrapper defines used in squid sources. This only applies to headers 
> bundled with squid and does not affect anything else operationally.
> 
> 
>  Proposed wrapper define format 
> 
> #ifndef SQUID_PATH_FILENAME_H
> #define SQUID_PATH_FILENAME_H
>...
> #endif /* SQUID_PATH_FILENAME_H */
> 
> so that each .h file was wrapped with a define indicating its current 
> location in the sources.
> 
> Not new, most files do this already with much variation on exact texts, 
> some do not. Just proposing it be formally adopted.

Do we want SRC in PATH? If we are moving every source file to src/ then
probably not, right?

Do we want underscores between path components? For example, 
ADAPTATIONICAP or ADAPTATION_ICAP for src/adaptation/icap/
FSDISKD or FS_DISKD for src/fs/diskd/

Adding underscores is more readable but I do not have a strong
preference so just pick whatever you think works best. 

I will dig out a script that fixes file preamble for all source files.
We can apply that once the layout has been fixed.

Thank you,

Alex.




TestBed extensions

2008-11-01 Thread Amos Jeffries
I'm contemplating a piece of automation to help manage the more complex 
testbed layers.


A piece of code to recursively scan the code files and pull out the 
unique dependency chains of nested #if...#endif.
Reducing the entire codebase to its preprocessor code and performing 
some of the minor actions as it goes.


From the chain output its relatively easy to manually or otherwise 
construct the minimal graphs of tests needed to cover all compile paths.


To work cleanly it would require a standardization of the .h safety 
wrapper defines used in squid sources. This only applies to headers 
bundled with squid and does not affect anything else operationally.



 Proposed wrapper define format 

#ifndef SQUID_PATH_FILENAME_H
#define SQUID_PATH_FILENAME_H
  ...
#endif /* SQUID_PATH_FILENAME_H */

so that each .h file was wrapped with a define indicating its current 
location in the sources.


Not new, most files do this already with much variation on exact texts, 
some do not. Just proposing it be formally adopted.



Amos
--
Please be using
  Current Stable Squid 2.7.STABLE5 or 3.0.STABLE10
  Current Beta Squid 3.1.0.1