source: MondoRescue/branches/3.0/mondo/test/test-truncname.c@ 3141

Last change on this file since 3141 was 3141, checked in by Bruno Cornec, 11 years ago

r5345@localhost: bruno | 2013-06-13 12:46:54 +0200

  • Solving #702 by adding a -F option which is meant to be used especially when mondoarchive is launched from cron, to avoid going into a loop where mondoarchive asks questions to the admin, where they cannot be answerd, which fills the logs and the underlying file system. With -F mondoarchive will exits at the first interaction request instead.
  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1/*
2 * $Id$
3 *
4 * Test program for mountlist management at restore time
5 * Cn be used on host system with valgrind easier than with mondorestore
6 */
7#include <stdio.h>
8#include "my-stuff.h"
9#include "mr_mem.h"
10#include "../common/mondostructures.h"
11#include "../common/libmondo.h"
12#include "../mondoarchive/mondoarchive.h"
13
14extern void twenty_seconds_til_yikes(void);
15
16/* Reference to global bkpinfo */
17struct s_bkpinfo *bkpinfo;
18
19extern bool g_text_mode;
20extern FILE *g_fprep;
21extern double g_kernel_version;
22extern int g_partition_table_locked_up;
23extern int g_noof_rows;
24
25/* Whether we should fail immediately at first error */
26bool g_fail_immediately = FALSE;
27
28bool g_ISO_restore_mode = FALSE; /* are we in Iso Mode? */
29bool g_I_have_just_nuked = FALSE;
30char *g_isodir_device;
31char *g_isodir_format;
32char *g_biggielist_txt;
33char *g_filelist_full;
34char *g_filelist_imagedevs;
35char *g_imagedevs_restthese;
36
37char *g_mondo_cfg_file;
38
39char *g_mountlist_fname;
40char *g_mondo_home;
41
42char *g_getfacl;
43char *g_getfattr;
44
45extern char *MONDO_LOGFILE;
46extern char *truncate_to_drive_name(const char *);
47/* We don't have a cleanup function yet */
48void (*mr_cleanup)(void) = NULL;
49void free_MR_global_filenames() {
50}
51
52int main() {
53
54char *part = NULL;
55char *disk = NULL;
56char *list[] = {
57 "/dev/sda99",
58 "/dev/hda12",
59 "/dev/cciss/c12d9p24",
60 "/dev/mapper/vg00lv02",
61 "/dev/mapper/dm-4",
62 "/dev/mapper/mpath4p19",
63 "/dev/mapper/part13",
64 "/dev/rd/c10d4p16",
65 "/dev/cciss/c1d12",
66 "/dev/mapper/mpath34",
67 NULL
68};
69int i;
70
71mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-truncname.log");
72
73/* Globals */
74g_loglevel = 99;
75g_text_mode = FALSE;
76g_main_pid = getpid();
77
78log_it("Begin loop");
79for (i=0; list[i] != NULL; i++) {
80 log_it("%d: partition %s ...",i, list[i]);
81 mr_asprintf(&part,"%s",list[i]);
82 disk = truncate_to_drive_name(part);
83 log_it("...belongs to disk %s",disk);
84 mr_free(part);
85}
86log_it("end of loop");
87mr_free(MONDO_LOGFILE);
88exit(0);
89}
Note: See TracBrowser for help on using the repository browser.