source: MondoRescue/branches/2.2.9/mondo/test/test-mountlist.c@ 2234

Last change on this file since 2234 was 2234, checked in by Bruno Cornec, 15 years ago

r3128@localhost: bruno | 2009-06-18 20:21:37 +0200

  • test mountlist now goes up to calling evaluate_mountlist
  • Property svn:eol-style set to native
File size: 2.4 KB
RevLine 
[2211]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 */
[2202]7#include <stdio.h>
8#include "my-stuff.h"
[2211]9#include "mr_mem.h"
[2202]10#include "../common/mondostructures.h"
11#include "../common/libmondo.h"
12#include "../mondorestore/mondorestore.h"
[2204]13#include "../mondorestore/mr-externs.h"
[2202]14
15extern void twenty_seconds_til_yikes(void);
16
17/* Reference to global bkpinfo */
18struct s_bkpinfo *bkpinfo;
19
20extern bool g_text_mode;
21extern FILE *g_fprep;
22extern double g_kernel_version;
23extern int g_partition_table_locked_up;
24extern int g_noof_rows;
25
26bool g_ISO_restore_mode = FALSE; /* are we in Iso Mode? */
27bool g_I_have_just_nuked = FALSE;
28char *g_isodir_device;
29char *g_isodir_format;
30char *g_biggielist_txt;
31char *g_filelist_full;
32char *g_filelist_imagedevs;
33char *g_imagedevs_restthese;
34
35char *g_mondo_cfg_file;
36
37char *g_mountlist_fname;
38char *g_mondo_home;
39
40char *g_getfacl;
41char *g_getfattr;
42
43extern char *MONDO_LOGFILE;
[2209]44extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, char direction);
45/* We don't have a cleanup function yet */
46void (*mr_cleanup)(void) = NULL;
[2202]47
48void main() {
49
[2234]50struct mountlist_itself *mountlist = NULL;
51struct raidlist_itself *raidlist;
52char *tmpA = NULL;
53char *tmpB = NULL;
54char *tmpC = NULL;
55bool ret = FALSE;
[2204]56
[2234]57mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
[2202]58
[2234]59/* Globals */
60g_loglevel = 99;
61g_text_mode = FALSE;
62g_main_pid = getpid();
[2206]63
[2234]64if (!(mountlist = malloc(sizeof(struct mountlist_itself)))) {
65 fatal_error("Cannot malloc mountlist");
66}
67if (!(raidlist = malloc(sizeof(struct raidlist_itself)))) {
68 fatal_error("Cannot malloc raidlist");
69}
70malloc_libmondo_global_strings();
[2202]71
72setup_newt_stuff();
[2211]73mr_asprintf(&g_mountlist_fname, "/tmp/mountlist.txt");
[2206]74log_it("before mountlist");
[2202]75load_mountlist(mountlist, g_mountlist_fname);
[2206]76log_it("after mountlist");
[2204]77resize_mountlist_proportionately_to_suit_new_drives(mountlist);
[2206]78log_it("after resize_mountlist_proportionately_to_suit_new_drives");
[2204]79load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
[2206]80log_it("after load_raidtab_into_raidlist");
[2204]81edit_mountlist(g_mountlist_fname, mountlist, raidlist);
[2206]82log_it("after edit_mountlist");
[2234]83
84mr_asprintf(&tmpA, "%s", " ");
85mr_asprintf(&tmpB, "%s", " ");
86mr_asprintf(&tmpC, "%s", " ");
87ret = evaluate_mountlist(mountlist, tmpA, tmpB, tmpC);
88log_it("after evaluate_mountlist");
[2204]89exit(0);
[2202]90}
Note: See TracBrowser for help on using the repository browser.