Changes in / [68e5464:dec60b4]


Ignore:
Files:
1 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r7d03c8d rde18326  
    3535pm_to_blib
    3636stamp-h1
    37 tester
    3837varstubs.c
  • Makefile.am

    rc45e1eb r5aa33fd  
    1212zcrypt_SOURCES = zcrypt.c filterproc.c
    1313
    14 check_PROGRAMS = tester perl_tester
     14check_PROGRAMS = tester.bin
    1515
    1616barnowl_bin_SOURCES = $(BASE_SRCS) \
     
    2121barnowl_bin_LDADD = libfaim/libfaim.a
    2222
    23 tester_SOURCES = $(BASE_SRCS) \
     23tester_bin_SOURCES = $(BASE_SRCS) \
    2424     owl.h owl_perl.h config.h \
    2525     $(GEN_C) $(GEN_H) \
    2626     tester.c
    2727
    28 tester_LDADD = libfaim/libfaim.a
    29 
    30 perl_tester_SOURCES = $(BASE_SRCS) \
    31      owl.h owl_perl.h config.h \
    32      $(GEN_C) $(GEN_H) \
    33      perl_tester.c
    34 
    35 perl_tester_LDADD = libfaim/libfaim.a
     28tester_bin_LDADD = libfaim/libfaim.a
    3629
    3730TESTS=runtests.sh
  • barnowl

    r9a7b4f2 rde18326  
    55
    66SRCDIR=`dirname "${0}"`
    7 EXE="$SRCDIR/barnowl.bin"
     7EXE="$0.bin"
    88
    99if ! test -x "$EXE"; then
  • global.c

    r68e5464 r68e5464  
    10321032  g->interrupted = 0;
    10331033}
     1034
     1035void owl_global_setup_default_filters(owl_global *g)
     1036{
     1037  int i;
     1038  static const struct {
     1039    const char *name;
     1040    const char *desc;
     1041  } filters[] = {
     1042    { "personal",
     1043      "private ^true$ and ( not type ^zephyr$ or "
     1044      "( class ^message and ( instance ^personal$ or instance ^urgent$ ) ) )" },
     1045    { "trash",
     1046      "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" },
     1047    { "wordwrap", "not ( type ^admin$ or type ^zephyr$ )" },
     1048    { "ping", "opcode ^ping$" },
     1049    { "auto", "opcode ^auto$" },
     1050    { "login", "not login ^none$" },
     1051    { "reply-lockout", "class ^noc or class ^mail$" },
     1052    { "out", "direction ^out$" },
     1053    { "aim", "type ^aim$" },
     1054    { "zephyr", "type ^zephyr$" },
     1055    { "none", "false" },
     1056    { "all", "true" },
     1057    { NULL, NULL }
     1058  };
     1059
     1060  owl_function_debugmsg("startup: creating default filters");
     1061
     1062  for (i = 0; filters[i].name != NULL; i++)
     1063    owl_global_add_filter(g, owl_filter_new_fromstring(filters[i].name,
     1064                                                       filters[i].desc));
     1065}
  • owl.c

    r3aa0522 r04b16f8  
    149149}
    150150
    151 static void owl_setup_default_filters(void)
    152 {
    153   int i;
    154   static const struct {
    155     const char *name;
    156     const char *desc;
    157   } filters[] = {
    158     { "personal",
    159       "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message  ) )" },
    160     { "trash",
    161       "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" },
    162     { "wordwrap", "not ( type ^admin$ or type ^zephyr$ )" },
    163     { "ping", "opcode ^ping$" },
    164     { "auto", "opcode ^auto$" },
    165     { "login", "not login ^none$" },
    166     { "reply-lockout", "class ^noc or class ^mail$" },
    167     { "out", "direction ^out$" },
    168     { "aim", "type ^aim$" },
    169     { "zephyr", "type ^zephyr$" },
    170     { "none", "false" },
    171     { "all", "true" },
    172     { NULL, NULL }
    173   };
    174 
    175   owl_function_debugmsg("startup: creating default filters");
    176 
    177   for (i = 0; filters[i].name != NULL; i++)
    178     owl_global_add_filter(&g, owl_filter_new_fromstring(filters[i].name,
    179                                                         filters[i].desc));
    180 }
    181151
    182152/*
     
    563533  owl_global_complete_setup(&g);
    564534
    565   owl_setup_default_filters();
     535  owl_global_setup_default_filters(&g);
    566536
    567537  /* set the current view */
  • perlconfig.c

    r3aa0522 r5aa33fd  
    1212/* extern XS(boot_DBI); */
    1313
    14 static void owl_perl_xs_init(pTHX)
     14void owl_perl_xs_init(pTHX) /* noproto */
    1515{
    1616  const char *file = __FILE__;
     
    363363  perl_construct(p);
    364364
     365  PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
     366
    365367  owl_global_set_no_have_config(&g);
    366368
  • runtests.sh

    r9f026c1 r5aa33fd  
    11#!/bin/sh
    2 HARNESS_PERL=./perl_tester exec prove t/
     2SRCDIR=`dirname "${0}"`
     3
     4export BARNOWL_DATA_DIR="$SRCDIR/perl/"
     5export BARNOWL_BIN_DIR="$SRCDIR/"
     6
     7HARNESS_PERL=./tester exec prove t/
  • t/00-core-tests.t

    r1cf3f8d3 r95414bf  
    11#!/usr/bin/env perl
    22use File::Basename;
    3 system(dirname($0) . "/../tester");
     3system(dirname($0) . "/../tester", "--builtin");
  • t/mock.pl

    r42ad917 r5aa33fd  
    1 use File::Basename;
    2 use lib (dirname($0) . '/../perl/lib');
    3 
    41package BarnOwl;
    52use strict;
    63use warnings;
    7 use Carp;
    84
    9 sub get_data_dir {"."}
    10 sub get_config_dir {"."}
    11 sub create_style {}
    12 
    13 sub debug {
     5no warnings 'redefine';
     6sub debug($) {
    147    warn "[DEBUG] ", shift, "\n" if $ENV{TEST_VERBOSE};
    158}
    169
    17 sub BarnOwl::Internal::new_command {}
    18 sub BarnOwl::Internal::new_variable_bool {}
    19 sub BarnOwl::Internal::new_variable_int {}
    20 sub BarnOwl::Internal::new_variable_string {}
    21 sub BarnOwl::Editwin::save_excursion(&) {}
    22 
    23 use BarnOwl;
    24 
    25101;
  • tester.c

    r3f6555d r95414bf  
     1#define OWL_PERL
     2#define WINDOW FAKE_WINDOW
    13#include "owl.h"
     4#undef WINDOW
     5
    26#include <unistd.h>
    37#include <stdlib.h>
    48
     9#undef instr
     10#include <curses.h>
     11
    512owl_global g;
    613
    714int numtests;
    815
     16int owl_regtest(void);
    917int owl_util_regtest(void);
    1018int owl_dict_regtest(void);
     
    1422int owl_editwin_regtest(void);
    1523
     24extern void owl_perl_xs_init(pTHX);
     25
    1626int main(int argc, char **argv, char **env)
    1727{
     28  FILE *rnull;
     29  FILE *wnull;
     30  char *perlerr;
     31  int status = 0;
     32
     33  if (argc <= 1) {
     34    fprintf(stderr, "Usage: %s --builtin|TEST.t|-le CODE\n", argv[0]);
     35    return 1;
     36  }
     37
    1838  /* initialize a fake ncurses, detached from std{in,out} */
    19   FILE *rnull = fopen("/dev/null", "r");
    20   FILE *wnull = fopen("/dev/null", "w");
     39  wnull = fopen("/dev/null", "w");
     40  rnull = fopen("/dev/null", "r");
    2141  newterm("xterm", wnull, rnull);
    2242  /* initialize global structures */
    2343  owl_global_init(&g);
    2444
     45  perlerr = owl_perlconfig_initperl(NULL, &argc, &argv, &env);
     46  if (perlerr) {
     47    endwin();
     48    fprintf(stderr, "Internal perl error: %s\n", perlerr);
     49    status = 1;
     50    goto out;
     51  }
     52
     53  owl_global_complete_setup(&g);
     54  owl_global_setup_default_filters(&g);
     55
     56  owl_view_create(owl_global_get_current_view(&g), "main",
     57                  owl_global_get_filter(&g, "all"),
     58                  owl_global_get_style_by_name(&g, "default"));
     59
     60  owl_function_firstmsg();
     61
     62  ENTER;
     63  SAVETMPS;
     64
     65  if (strcmp(argv[1], "--builtin") == 0) {
     66    status = owl_regtest();
     67  } else if (strcmp(argv[1], "-le") == 0 && argc > 2) {
     68    /*
     69     * 'prove' runs its harness perl with '-le CODE' to get some
     70     * information out.
     71     */
     72    moreswitches("l");
     73    eval_pv(argv[2], true);
     74  } else {
     75    sv_setpv(get_sv("0", false), argv[1]);
     76    sv_setpv(get_sv("main::test_prog", TRUE), argv[1]);
     77
     78    eval_pv("do $main::test_prog; die($@) if($@)", true);
     79  }
     80
     81  status = 0;
     82
     83  FREETMPS;
     84  LEAVE;
     85
     86 out:
     87  perl_destruct(owl_global_get_perlinterp(&g));
     88  perl_free(owl_global_get_perlinterp(&g));
     89  /* probably not necessary, but tear down the screen */
     90  endwin();
     91  fclose(rnull);
     92  fclose(wnull);
     93  return status;
     94}
     95
     96int owl_regtest(void) {
    2597  numtests = 0;
    2698  int numfailures=0;
     
    38110  }
    39111  printf("1..%d\n", numtests);
    40 
    41   /* probably not necessary, but tear down the screen */
    42   endwin();
    43   fclose(rnull);
    44   fclose(wnull);
    45112
    46113  return(numfailures);
Note: See TracChangeset for help on using the changeset viewer.