Difference between revisions of "Testing and Development Tools and Tips"

From OpenSSLWiki
Jump to navigationJump to search
(Flesh out Testing Environment and Tools)
(Flesh out Cscope section)
Line 14: Line 14:
  
 
== Cscope ==
 
== Cscope ==
 +
[http://cscope.sourceforge.net/ Cscope] is a powerful C source code browser. Once you have it installed, you can use the <code>make-cscope</code> and <code>open-cscope</code> functions from <code>test/test_env.bash</code>.
 +
 
=== Vim Integration ===
 
=== Vim Integration ===
 +
Once <code>$CSCOPE_DB</code> (defined in <code>test/test_env.bash</code> is built using <code>make-cscope</code>, you can take advantage of the Cscope integration in Vim by adding something like the following to your <code>.vimrc</code>:
 +
 +
<pre>
 +
" Detect whether cscope features are present and whether we should add a
 +
" connection to an existing cscope.out database file
 +
if has("cscope")
 +
  set nocsverb
 +
  if filereadable("./cscope.out")
 +
    cs add cscope.out
 +
  elseif $CSCOPE_DB != ""
 +
    if filereadable($CSCOPE_DB)
 +
      cs add $CSCOPE_DB
 +
    else
 +
      echo "Can't read $CSCOPE_DB; cscope add not run"
 +
    endif
 +
  endif
 +
  set csre
 +
  set csverb
 +
endif
 +
</pre>
  
 
== Ctags ==
 
== Ctags ==

Revision as of 16:48, 10 June 2014

This is a collection of helpful tools and tips for navigating the OpenSSL code base and managing a local git repository.

Testing Environment and Tools

In the test-util branch of Mike Bland's fork are a few helper files that you may wish to copy or pull into your branch.

test/testutil.h

Defines the generic SETUP_TEST_FIXTURE and EXECUTE_TEST macros. Should be pulled into the mainline pending acceptance of pull request #126.

test/new-test.sh

Generates a new automated test stub, following the Pseudo-xUnit Pattern and using the macros from test/testutil.h. The generated stub will compile standalone.

test/test_env.bash

Environment variables, functions, and aliases to help with OpenSSL unit testing. The header comments contain documentation on each of the functions and aliases in the file.

Cscope

Cscope is a powerful C source code browser. Once you have it installed, you can use the make-cscope and open-cscope functions from test/test_env.bash.

Vim Integration

Once $CSCOPE_DB (defined in test/test_env.bash is built using make-cscope, you can take advantage of the Cscope integration in Vim by adding something like the following to your .vimrc:

" Detect whether cscope features are present and whether we should add a
" connection to an existing cscope.out database file
if has("cscope")
  set nocsverb
  if filereadable("./cscope.out")
    cs add cscope.out
  elseif $CSCOPE_DB != ""
    if filereadable($CSCOPE_DB)
      cs add $CSCOPE_DB
    else
      echo "Can't read $CSCOPE_DB; cscope add not run"
    endif
  endif
  set csre
  set csverb
endif

Ctags

Vim Integration

git-new-workdir