From 5cf560bc67a516dbede41da857a87af5dca8a6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Thu, 8 Jul 2010 16:54:34 +0800 Subject: [PATCH] restored valgrind.suppress file. --- .gitignore | 2 ++ deps/test-nginx | 2 +- t/4-require.t | 61 +++++++++++++++++++++++++++++++++++++++++++++++ util/fix-comments | 27 +++++++++++++++++++++ valgrind.suppress | 18 ++++++++++++++ 5 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 t/4-require.t create mode 100644 util/fix-comments create mode 100644 valgrind.suppress diff --git a/.gitignore b/.gitignore index 04d9733b..47d3ae92 100644 --- a/.gitignore +++ b/.gitignore @@ -95,3 +95,5 @@ src/clfactory.h src/filter.c src/filter.h src/contentby.c +pack +b.sh diff --git a/deps/test-nginx b/deps/test-nginx index 41bdd4da..07e53234 160000 --- a/deps/test-nginx +++ b/deps/test-nginx @@ -1 +1 @@ -Subproject commit 41bdd4da22db6469b2ae30c8886549e6eff26699 +Subproject commit 07e53234cbd4835ef17afa8ba7f5c1028490e0dc diff --git a/t/4-require.t b/t/4-require.t new file mode 100644 index 00000000..c7485b3e --- /dev/null +++ b/t/4-require.t @@ -0,0 +1,61 @@ +# vi:ft= +use lib 'lib'; +use Test::Nginx::Socket; + +#worker_connections(1014); +#master_process_enabled(1); +#log_level('warn'); + +#repeat_each(120); +repeat_each(1); + +plan tests => blocks() * repeat_each() * 2; + +my $html_dir = html_dir; +#warn $html_dir; + +$ENV{LUA_PATH} = "$html_dir/?.lua"; + +#no_diff(); +#no_long_string(); +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /main { + echo_location /load; + echo_location /check; + echo_location /check; + } + + location /load { + content_by_lua 'package.loaded.foo = null; require "foo";'; + } + + location /check { + content_by_lua ' + if package.loaded.foo then + ngx.say("found") + else + ngx.say("not found") + end + '; + } +--- request +GET /main +--- user_files +>>> foo.lua +module(..., package.seeall); + +ngx.say("loading"); + +function hi () + ngx.say("hello, foo") +end; +--- response_body +loading +found +found + diff --git a/util/fix-comments b/util/fix-comments new file mode 100644 index 00000000..bcf1d5db --- /dev/null +++ b/util/fix-comments @@ -0,0 +1,27 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +for my $infile (@ARGV) { + warn "Processing $infile...\n"; + open my $in, $infile or + die "Cannot open $infile for reading: $!\n"; + my $s; + my $changed = 0; + while (<$in>) { + $changed += s{//(.*)}{/* $1 */}; + $s .= $_; + } + close $in; + + if ($changed) { + my $outfile = $infile; + open my $out, ">$outfile" or + die "Cannot open $outfile for writing: $!\n"; + print $out $s; + close $out; + warn "Wrote $outfile\n"; + } +} + diff --git a/valgrind.suppress b/valgrind.suppress new file mode 100644 index 00000000..73bcedde --- /dev/null +++ b/valgrind.suppress @@ -0,0 +1,18 @@ +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_event_process_init + fun:ngx_single_process_cycle + fun:main +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_crc32_table_init + fun:main +} +