diff options
author | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
commit | 84adefa331c4159d432d22840663c38f155cd4c1 (patch) | |
tree | bff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/kernel/test/disk_log_SUITE_data | |
download | otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2 otp-84adefa331c4159d432d22840663c38f155cd4c1.zip |
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/kernel/test/disk_log_SUITE_data')
15 files changed, 245 insertions, 0 deletions
diff --git a/lib/kernel/test/disk_log_SUITE_data/Makefile.src b/lib/kernel/test/disk_log_SUITE_data/Makefile.src new file mode 100644 index 0000000000..cae2f23d29 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/Makefile.src @@ -0,0 +1,15 @@ +CC = @CC@ +LD = @LD@ +CFLAGS = @CFLAGS@ -I@erl_include@ @DEFS@ +CROSSLDFLAGS = @CROSSLDFLAGS@ + +PROGS = nfs_check@exe@ + +all: $(PROGS) + +nfs_check@exe@: nfs_check@obj@ + $(LD) $(CROSSLDFLAGS) -o nfs_check nfs_check@obj@ @LIBS@ + +nfs_check@obj@: nfs_check.c + $(CC) -c -o nfs_check@obj@ $(CFLAGS) nfs_check.c + diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.1 b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.1 Binary files differnew file mode 100644 index 0000000000..4ab4382c54 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.1 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.2 b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.2 Binary files differnew file mode 100644 index 0000000000..491f23d0a2 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.2 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.3 b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.3 Binary files differnew file mode 100644 index 0000000000..d690c59365 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.3 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.4 b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.4 Binary files differnew file mode 100644 index 0000000000..c61526e1b7 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.4 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.idx b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.idx Binary files differnew file mode 100644 index 0000000000..1250cdcaf3 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt.LOG.idx diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.1 b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.1 Binary files differnew file mode 100644 index 0000000000..4ab4382c54 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.1 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.2 b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.2 Binary files differnew file mode 100644 index 0000000000..491f23d0a2 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.2 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.3 b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.3 Binary files differnew file mode 100644 index 0000000000..d690c59365 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.3 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.4 b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.4 Binary files differnew file mode 100644 index 0000000000..c61526e1b7 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.4 diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.idx b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.idx Binary files differnew file mode 100644 index 0000000000..2d3456e88d --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.idx diff --git a/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.siz b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.siz Binary files differnew file mode 100644 index 0000000000..dea523e149 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/kurt2.LOG.siz diff --git a/lib/kernel/test/disk_log_SUITE_data/nfs_check.c b/lib/kernel/test/disk_log_SUITE_data/nfs_check.c new file mode 100644 index 0000000000..31e9ba8190 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/nfs_check.c @@ -0,0 +1,46 @@ +/* + * Author: Patrik Nyblom + * Purpose: A port program to check the NFS cache size on VxWorks (returns 0 + * for other platforms). + */ + +#ifdef VXWORKS +#include <vxWorks.h> +#include <taskVarLib.h> +#include <taskLib.h> +#include <sysLib.h> +#include <string.h> +#include <ioLib.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#ifdef VXWORKS +extern unsigned nfsCacheSize; +#define MAIN(argc, argv) nfs_check(argc, argv) +#else +#define MAIN(argc, argv) main(argc, argv) +#endif + + +MAIN(argc, argv) +int argc; +char *argv[]; +{ +#ifdef VXWORKS + char str[100]; + sprintf(str,"%d\n", nfsCacheSize); + write(1, str, strlen(str)); +#else + fprintf(stdout,"0"); + fflush(stdout); +#endif + return 0; +} + diff --git a/lib/kernel/test/disk_log_SUITE_data/old_terms.LOG b/lib/kernel/test/disk_log_SUITE_data/old_terms.LOG Binary files differnew file mode 100644 index 0000000000..fffd8c1679 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/old_terms.LOG diff --git a/lib/kernel/test/disk_log_SUITE_data/wrap_log_test.erl b/lib/kernel/test/disk_log_SUITE_data/wrap_log_test.erl new file mode 100644 index 0000000000..e5ff70fd49 --- /dev/null +++ b/lib/kernel/test/disk_log_SUITE_data/wrap_log_test.erl @@ -0,0 +1,184 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%%%---------------------------------------------------------------------- +%%% Purpose : Test wrap_log_reader.erl +%%%---------------------------------------------------------------------- + +-module(wrap_log_test). + +-export([init/0, stop/0]). +-define(fsize, 80). +-define(fno, 4). + +%-define(debug, true). + +-ifdef(debug). +-define(format(S, A), io:format(S, A)). +-else. +-define(format(S, A), ok). +-endif. + +init() -> + spawn(fun() -> start(logger) end), + spawn(fun() -> start2(wlt) end), + wait_registered(logger), + wait_registered(wlt), + ok. + +wait_registered(Name) -> + case whereis(Name) of + undefined -> + timer:sleep(100), + wait_registered(Name); + _Pid -> + ok + end. + +stop() -> + catch logger ! exit, + catch wlt ! exit, + wait_unregistered(logger), + wait_unregistered(wlt), + ok. + +wait_unregistered(Name) -> + case whereis(Name) of + undefined -> + ok; + _Pid -> + timer:sleep(100), + wait_unregistered(Name) + end. + +start(Name) -> + ?format("Starting ~p~n", [Name]), + register(Name, self()), + loop(). + +start2(Name) -> + ?format("Starting ~p~n", [Name]), + register(Name, self()), + loop2(eof, Name). + +loop() -> + receive + {open, Pid, Name, File} -> + R = disk_log:open([{name, Name}, {type, wrap}, {file, File}, + {size, {?fsize, ?fno}}]), + ?format("logger: open ~p -> ~p~n", [Name, R]), + Pid ! R, + loop(); + + {open_ext, Pid, Name, File} -> + R = disk_log:open([{name, Name}, {type, wrap}, {file, File}, + {format, external}, {size, {?fsize, ?fno}}]), + ?format("logger: open ~p -> ~p~n", [Name, R]), + Pid ! R, + loop(); + + {close, Pid, Name} -> + R = disk_log:close(Name), + ?format("logger: close ~p -> ~p~n", [Name, R]), + Pid ! R, + loop(); + + {sync, Pid, Name} -> + R = disk_log:sync(Name), + ?format("logger: sync ~p -> ~p~n", [Name, R]), + Pid ! R, + loop(); + + {log_terms, Pid, Name, Terms} -> + R = disk_log:log_terms(Name, Terms), + ?format("logger: log_terms ~p -> ~p~n", [Name, R]), + Pid ! R, + loop(); + + {blog_terms, Pid, Name, Terms} -> + R = disk_log:blog_terms(Name, Terms), + ?format("logger: blog_terms ~p -> ~p~n", [Name, R]), + Pid ! R, + loop(); + + exit -> + ?format("Stopping logger~n", []), + exit(normal); + + _Else -> + ?format("logger: ignored: ~p~n", [_Else]), + loop() + end. + +loop2(C, Wlt) -> + receive + {open, Pid, Name} -> + case wrap_log_reader:open(Name) of + {ok, R} -> + ?format("~p: open ~p -> ~p~n", [Wlt, Name, {ok, R}]), + Pid ! {ok, R}, + loop2(R, Wlt); + E -> + ?format("~p: open ~p -> ~p~n", [Wlt, Name, E]), + Pid ! E, + loop2(C, Wlt) + end; + + {open, Pid, Name, No} -> + case wrap_log_reader:open(Name, No) of + {ok, R} -> + ?format("~p: open ~p, file ~p -> ~p~n", + [Wlt, Name, No, {ok, R}]), + Pid ! {ok, R}, + loop2(R, Wlt); + E -> + ?format("~p: open ~p, file ~p -> ~p~n", + [Wlt, Name, No, E]), + Pid ! E, + loop2(C, Wlt) + end; + + {close, Pid, WR} -> + R = wrap_log_reader:close(WR), + ?format("~p: close -> ~p~n", [Wlt, R]), + Pid ! R, + loop2(eof, Wlt); + + {chunk, Pid, WR} -> + did_chunk(wrap_log_reader:chunk(WR), Pid, Wlt); + + {chunk, Pid, WR, N} -> + did_chunk(wrap_log_reader:chunk(WR, N), Pid, Wlt); + + exit -> + ?format("Stopping ~p~n", [Wlt]), + exit(normal); + + _Else -> + ?format("~p: ignored: ~p~n", [Wlt, _Else]), + loop2(C, Wlt) + end. + +did_chunk({C1, L}, Pid, Wlt) -> + ?format("~p: chunk -> ~p~n", [Wlt, {C1, L}]), + Pid ! {C1, L}, + loop2(C1, Wlt); +did_chunk({C1, L, _Bad}, Pid, Wlt) -> + ?format("~p: chunk -> ~p (bad)~n", [Wlt, {C1, L, _Bad}]), + Pid ! {C1, L}, + loop2(C1, Wlt). |