Skip to content

Commit

Permalink
don't use /etc/tmtest.conf and ~/.tmtestrc anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
bronson committed Feb 22, 2011
1 parent 814a48a commit 4e7e2e2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 61 deletions.
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ endif
# NOTE: This will remove the configuration file too!
uninstall: tmtest
rm $(bindir)/tmtest
ifeq ($(prefix), $(HOME))
rm $(HOME)/.tmtestrc
else
rm /etc/tmtest.conf
endif

clean:
rm -f tmtest template.c tags
Expand Down
5 changes: 2 additions & 3 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
0.960:
- git rid of /etc/tmtestrc and ~/.tmtestrc
- Munge diff file to have a/file and b/file so there's no need to pass -p0
- Run in print failures only mode by default, -v to get every result.
Can we sense a terminal and print a running count statusline?
Print a dot for each success, F for failure, A for abort, and ? for disabled.
- Munge diff file to have a/file and b/file so there's no need to pass -p0
- Config file runs all tests with -e. Fix and remove all "set +e" from tests.

0.962:
Expand Down
3 changes: 1 addition & 2 deletions test.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ typedef enum {
// (only print results, no statistics or other useful conversation).
extern int quiet;

// If this is set, then we should use it as the config file rather than
// checking /etc/tmtest.conf, ~/.tmtestrc, etc.
// if set then read this config file before scanning through directories
extern char *config_file;

// all strings are malloc'd and need to be freed when the test is finished.
Expand Down
6 changes: 0 additions & 6 deletions tmtest.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@


# This file tells how to run tests on tmtest itself.
# See tmtestetc or tmtestrc for examples of globally-installed
# configuration files.


# This can be a little confusing because one copy of tmtest runs another
Expand All @@ -15,10 +13,6 @@
# Because the user launched the superexec, we have no control over which
# executable is used to run the tests. Hopefully it's reasonably stable.
#
# This configuration file, tmtest.conf, tells the superexec how to run the
# test battery. Local settings are read from /etc/tmtest.conf, ~/.tmtestrc,
# etc., then this file is loaded.
#
# The subtests do not read any configuration files outside of the test
# directory except for one, tmtest.sub.conf.

Expand Down
14 changes: 7 additions & 7 deletions tmtest.pod
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ B<tmtest> [B<-d>|B<-o>] [I<dir>|I<testfile>...]

=item B<-c> B<--config>

Specifies the config file to be read before running the test file.
Prevents the standard config files (/etc/tmtest.conf, /etc/tmtest/tmtest.conf,
~/.tmtestrc) from being read. Also doesn't read config files unless they
are below the directory that contains the specified file.
Specifies a config file to be read before running the test file.
tmtest will still look upward in the file hierarchy for tmtest.conf
files. Settings in tmtest.conf files override files specified by
--config.

=item B<-d> B<--diff>

Expand Down Expand Up @@ -61,12 +61,12 @@ quieter than it normally is but it certainly isn't silent.

=head1 CONFIGURATION

tmtest reads its configuration first from F</etc/tmtest.conf> and
F<~/.tmtest.conf>. Then it starts at the root directory and works
tmtest first reads the file specified by --config if supplied.
Then it starts at the root directory and works
its way up to the current directory looking for files named "tmtest.conf"
Therefore, /home/test/a/b/tmtest.conf overrides /home/test/tmtest.conf
(because the latter is read and executed before the former).
It executes each config files every time it runs a test. If you're
It executes each config file every time it runs a test. If you're
running 40 tests, your config files will each get executed 40 times.

Any output produced by the config files goes straight to the screen.
Expand Down
38 changes: 0 additions & 38 deletions vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "vars.h"

#define CONFIG_FILE "tmtest.conf"
#define HOME_CONFIG_FILE ".tmtestrc"


/** @file vars.c
Expand Down Expand Up @@ -80,30 +79,6 @@ static int var_statusfd(struct test *test, FILE *fp, const char *var)
}


/** Returns the full path to the user's home directory.
*/

static char* get_home_dir(struct test *test)
{
char *cp;
struct passwd *entry;

cp = getenv("HOME");
if(cp) return cp;
cp = getenv("LOGDIR");
if(cp) return cp;

entry = getpwuid(getuid());
if(entry) {
cp = entry->pw_dir;
if(cp) return cp;
}

test_abort(test, "Could not locate your home directory! Please set $HOME.\n");
return NULL; // will never be executed
}


/** Returns true if the given file exists, false if not.
*/

Expand Down Expand Up @@ -164,15 +139,6 @@ static void check_config(struct test *test, FILE *fp,


/** Prints the shell commands needed to read in all available config files.
*
* for instance:
*
* echo 'CONFIG: /etc/tmtest' >&5
* . '/etc/tmtest'
* echo 'CONFIG: /home/bronson/tmtest/tmtest.conf' >&5
* . '/home/bronson/tmtest/tmtest.conf'
*
* and so on...
*/

static int var_config_files(struct test *test, FILE *fp, const char *var)
Expand All @@ -197,10 +163,6 @@ static int var_config_files(struct test *test, FILE *fp, const char *var)
*cp = '\0';
check_config_str(test, fp, buf, cp+1);
config_file = oldcfg;
} else {
check_config_str(test, fp, "/etc", CONFIG_FILE);
check_config_str(test, fp, "/etc/tmtest", CONFIG_FILE);
check_config_str(test, fp, get_home_dir(test), HOME_CONFIG_FILE);
}

// check config files in the current hierarchy
Expand Down

0 comments on commit 4e7e2e2

Please sign in to comment.