aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/cov-blame48
-rwxr-xr-xcontrib/cov-diff17
-rwxr-xr-xcontrib/coverage46
-rwxr-xr-xcontrib/findMergedChanges.pl17
-rw-r--r--contrib/id_to_fp.c77
-rw-r--r--contrib/include.am1
-rwxr-xr-xcontrib/redox.py23
-rw-r--r--contrib/tor-mingw.nsi.in2
-rwxr-xr-xcontrib/torify (renamed from contrib/torify.in)0
9 files changed, 141 insertions, 90 deletions
diff --git a/contrib/cov-blame b/contrib/cov-blame
new file mode 100755
index 000000000..601f21195
--- /dev/null
+++ b/contrib/cov-blame
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+import os
+import re
+import subprocess
+import sys
+
+def handle_file(source_fname, cov_fname):
+
+ lines_blm = subprocess.Popen(["git", "blame", source_fname], stdout=subprocess.PIPE).stdout.readlines()
+ lines_cov = open(cov_fname).readlines()
+
+ # XXXX expensive!
+ while re.match(r'\s*-:\s*0:', lines_cov[0]):
+ del lines_cov[0]
+
+ if len(lines_blm) != len(lines_cov):
+ print >>sys.stderr, "MISMATCH IN NUMBER OF LINES in",source_fname
+
+ for b,c in zip(lines_blm, lines_cov):
+ m = re.match(r'\s*([^\s:]+):', c)
+ if not m:
+ print >>sys.stderr, "CONFUSING LINE %r"% c
+ cov = 'X'
+ elif m.group(1) == '-':
+ cov = '-'
+ elif m.group(1)[0] == '#':
+ cov = '#'
+ elif m.group(1)[0].isdigit():
+ cov = '1'
+ else:
+ print >>sys.stderr, "CONFUSING LINE %r"% c
+ cov = 'X'
+
+ print cov, b,
+
+COV_DIR = sys.argv[1]
+SOURCES = sys.argv[2:]
+
+for fn in SOURCES:
+ _, base = os.path.split(fn)
+ cfn = os.path.join(COV_DIR, base)
+ cfn += ".gcov"
+ if os.path.exists(cfn):
+ handle_file(fn, cfn)
+ else:
+ print >>sys.stderr, "NO FILE EXISTS CALLED ",cfn
+
diff --git a/contrib/cov-diff b/contrib/cov-diff
new file mode 100755
index 000000000..33a54802b
--- /dev/null
+++ b/contrib/cov-diff
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Copyright 2013 The Tor Project, Inc.
+# See LICENSE for licensing information.
+
+# cov-diff -- compare two directories full of gcov files.
+
+DIRA="$1"
+DIRB="$2"
+
+for A in $DIRA/*; do
+ B=$DIRB/`basename $A`
+ perl -pe 's/^\s*\d+:/ 1:/; s/^([^:]+:)[\d\s]+:/$1/;' "$A" > "$A.tmp"
+ perl -pe 's/^\s*\d+:/ 1:/; s/^([^:]+:)[\d\s]+:/$1/;' "$B" > "$B.tmp"
+ diff -u "$A.tmp" "$B.tmp"
+ rm "$A.tmp" "$B.tmp"
+done
+
diff --git a/contrib/coverage b/contrib/coverage
new file mode 100755
index 000000000..f4ae47582
--- /dev/null
+++ b/contrib/coverage
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright 2013 The Tor Project, Inc.
+# See LICENSE for licensing information.
+
+# coverage -- run gcov on the appropriate set of object files to extract
+# coverage information.
+
+dst=$1
+
+for fn in src/or/*.c src/common/*.c; do
+ BN=`basename $fn`
+ DN=`dirname $fn`
+ F=`echo $BN | sed -e 's/\.c$//;'`
+ GC="${BN}.gcov"
+ # Figure out the object file names
+ ONS=`echo ${DN}/src_*-${F}.o`
+ ONS_WILDCARD_LITERAL="${DN}/src_*-${F}.o"
+ # If the wildcard didn't expand, no files
+ if [ "$ONS" != "${ONS_WILDCARD_LITERAL}" ]
+ then
+ for on in $ONS; do
+ # We should have a gcno file
+ GCNO=`echo $on | sed -e 's/\.o$/\.gcno/;'`
+ if [ -e $GCNO ]
+ then
+ # No need to test for gcda, since gcov assumes no execution
+ # if it's absent
+ rm -f $GC
+ gcov -o $on $fn
+ if [ -e $GC ]
+ then
+ if [ -n $dst ]
+ then
+ mv $GC $dst/$GC
+ fi
+ else
+ echo "gcov -o $on $fn didn't make a .gcov file"
+ fi
+ else
+ echo "Couldn't find gcno file for $on"
+ fi
+ done
+ else
+ echo "No object file found matching source file $fn"
+ fi
+done
diff --git a/contrib/findMergedChanges.pl b/contrib/findMergedChanges.pl
index e4ff6163e..d6c4105b7 100755
--- a/contrib/findMergedChanges.pl
+++ b/contrib/findMergedChanges.pl
@@ -8,7 +8,7 @@ sub nChanges {
local *F;
# requires perl 5.8. Avoids shell issues if we ever get a changes
# file named by the parents of Little Johnny Tables.
- open F, "-|", "git", "log", "--pretty=format:%H", $branches, "--", $fname
+ open F, "-|", "git", "log", "--no-merges", "--pretty=format:%H", $branches, "--", $fname
or die "$!";
my @changes = <F>;
return scalar @changes
@@ -19,15 +19,15 @@ my $look_for_type = "merged";
if (! @ARGV) {
print <<EOF
Usage:
- findMergedChanges.pl [--merged/--unmerged/--weird/--list] [--branch=<branchname] changes/*
+ findMergedChanges.pl [--merged/--unmerged/--weird/--list] [--branch=<branchname] [--head=<branchname>] changes/*
-A change is "merged" if it has ever been merged to release-0.2.2 and it has had
+A change is "merged" if it has ever been merged to release-0.2.4 and it has had
no subsequent changes in master.
-A change is "unmerged" if it has never been merged to release-0.2.2 and it
+A change is "unmerged" if it has never been merged to release-0.2.4 and it
has had changes in master.
-A change is "weird" if it has been merged to release-0.2.2 and it *has* had
+A change is "weird" if it has been merged to release-0.2.4 and it *has* had
subsequent changes in master.
Suggested application:
@@ -36,7 +36,8 @@ Suggested application:
EOF
}
-my $target_branch = "origin/release-0.2.2";
+my $target_branch = "origin/release-0.2.4";
+my $head = "origin/master";
while (@ARGV and $ARGV[0] =~ /^--/) {
my $flag = shift @ARGV;
@@ -44,6 +45,8 @@ while (@ARGV and $ARGV[0] =~ /^--/) {
$look_for_type = $1;
} elsif ($flag =~ /^--branch=(\S+)/) {
$target_branch = $1;
+ } elsif ($flag =~ /^--head=(\S+)/) {
+ $head = $1;
} else {
die "Unrecognized flag $flag";
}
@@ -51,7 +54,7 @@ while (@ARGV and $ARGV[0] =~ /^--/) {
for my $changefile (@ARGV) {
my $n_merged = nChanges($target_branch, $changefile);
- my $n_postmerged = nChanges("${target_branch}..origin/master", $changefile);
+ my $n_postmerged = nChanges("${target_branch}..${head}", $changefile);
my $type;
if ($n_merged != 0 and $n_postmerged == 0) {
diff --git a/contrib/id_to_fp.c b/contrib/id_to_fp.c
deleted file mode 100644
index 55b025dfa..000000000
--- a/contrib/id_to_fp.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Copyright 2006 Nick Mathewson; see LICENSE for licensing information */
-
-/* id_to_fp.c : Helper for directory authority ops. When somebody sends us
- * a private key, this utility converts the private key into a fingerprint
- * so you can de-list that fingerprint.
- */
-
-#include <openssl/rsa.h>
-#include <openssl/bio.h>
-#include <openssl/sha.h>
-#include <openssl/pem.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define die(s) do { fprintf(stderr, "%s\n", s); goto err; } while (0)
-
-int
-main(int argc, char **argv)
-{
- BIO *b = NULL;
- RSA *key = NULL;
- unsigned char *buf = NULL, *bufp;
- int len, i;
- unsigned char digest[20];
- int status = 1;
-
- if (argc < 2) {
- fprintf(stderr, "Reading key from stdin...\n");
- if (!(b = BIO_new_fp(stdin, BIO_NOCLOSE)))
- die("couldn't read from stdin");
- } else if (argc == 2) {
- if (strcmp(argv[1], "-h") == 0 ||
- strcmp(argv[1], "--help") == 0) {
- fprintf(stdout, "Usage: %s [keyfile]\n", argv[0]);
- status = 0;
- goto err;
- } else {
- if (!(b = BIO_new_file(argv[1], "r")))
- die("couldn't open file");
- }
- } else {
- fprintf(stderr, "Usage: %s [keyfile]\n", argv[0]);
- goto err;
- }
- if (!(key = PEM_read_bio_RSAPrivateKey(b, NULL, NULL, NULL)))
- die("couldn't parse key");
-
- len = i2d_RSAPublicKey(key, NULL);
- if (len < 0)
- die("Bizarre key");
- bufp = buf = malloc(len+1);
- if (!buf)
- die("Out of memory");
- len = i2d_RSAPublicKey(key, &bufp);
- if (len < 0)
- die("Bizarre key");
-
- SHA1(buf, len, digest);
- for (i=0; i < 20; i += 2) {
- printf("%02X%02X ", (int)digest[i], (int)digest[i+1]);
- }
- printf("\n");
-
- status = 0;
-
-err:
- if (buf)
- free(buf);
- if (key)
- RSA_free(key);
- if (b)
- BIO_free(b);
- return status;
-}
-
diff --git a/contrib/include.am b/contrib/include.am
index 6d7fb16f9..62b76ebeb 100644
--- a/contrib/include.am
+++ b/contrib/include.am
@@ -12,6 +12,7 @@ EXTRA_DIST+= \
contrib/tor.ico \
contrib/tor.nsi.in \
contrib/tor.sh \
+ contrib/torify \
contrib/torctl
bin_SCRIPTS+= contrib/torify
diff --git a/contrib/redox.py b/contrib/redox.py
index e9914dab1..550f84686 100755
--- a/contrib/redox.py
+++ b/contrib/redox.py
@@ -62,7 +62,7 @@ KINDS = [ "type", "field", "typedef", "define", "function", "variable",
NODOC_LINE_RE = re.compile(r'^([^:]+):(\d+): (\w+): (.*) is not documented\.$')
-THING_RE = re.compile(r'^Member ([a-zA-Z0-9_]+).*\((typedef|define|function|variable|enumeration)\) of (file|class) ')
+THING_RE = re.compile(r'^Member ([a-zA-Z0-9_]+).*\((typedef|define|function|variable|enumeration|macro definition)\) of (file|class) ')
SKIP_NAMES = [re.compile(s) for s in SKIP_NAME_PATTERNS]
@@ -105,9 +105,13 @@ def findline(lines, lineno, ident):
"""Given a list of all the lines in the file (adjusted so 1-indexing works),
a line number that ident is alledgedly on, and ident, I figure out
the line where ident was really declared."""
+ lno = lineno
for lineno in xrange(lineno, 0, -1):
- if ident in lines[lineno]:
- return lineno
+ try:
+ if ident in lines[lineno]:
+ return lineno
+ except IndexError:
+ continue
return None
@@ -126,8 +130,16 @@ def hascomment(lines, lineno, kind):
def hasdocdoc(lines, lineno, kind):
"""I return true if it looks like there's already a docdoc comment about
the thing on lineno of lines of type kind."""
- if "DOCDOC" in lines[lineno] or "DOCDOC" in lines[lineno-1]:
- return True
+ try:
+ if "DOCDOC" in lines[lineno]:
+ return True
+ except IndexError:
+ pass
+ try:
+ if "DOCDOC" in lines[lineno-1]:
+ return True
+ except IndexError:
+ pass
if kind == 'function' and FUNC_PAT.match(lines[lineno]):
if "DOCDOC" in lines[lineno-2]:
return True
@@ -210,6 +222,7 @@ def applyComments(fn, entries):
e = read()
for fn, errs in e.iteritems():
+ print `(fn, errs)`
comments = checkf(fn, errs)
if comments:
applyComments(fn, comments)
diff --git a/contrib/tor-mingw.nsi.in b/contrib/tor-mingw.nsi.in
index d5379bd57..d14ff791b 100644
--- a/contrib/tor-mingw.nsi.in
+++ b/contrib/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!insertmacro GetParameters
-!define VERSION "0.2.4.10-alpha-dev"
+!define VERSION "0.2.5.3-alpha-dev"
!define INSTALLER "tor-${VERSION}-win32.exe"
!define WEBSITE "https://www.torproject.org/"
!define LICENSE "LICENSE"
diff --git a/contrib/torify.in b/contrib/torify
index 54acfed65..54acfed65 100755
--- a/contrib/torify.in
+++ b/contrib/torify