.autotest: CheckBak

git-svn-id: svn://ultimatepp.org/upp/trunk@9407 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-01-16 21:52:54 +00:00
parent 96d6fd2b52
commit e0eee2f89f

View file

@ -6,7 +6,7 @@ CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
String s = Sys("svn info svn://www.ultimatepp.org/bak");
String s = Sys("svn info svn://localhost/upp");
LOG("SVN info:");
LOG(s);
String key = "Last Changed Date: ";
@ -20,33 +20,46 @@ CONSOLE_APP_MAIN
d.year = atoi(s);
d.month = atoi(~s + 5);
d.day = atoi(~s + 8);
LOG("Bak repository last date: " << d);
LOG("Mirror repository last date: " << d);
ASSERT(d >= GetSysDate() - 1);
for(int pass = 0; pass < 3; pass++) {
String dir = decode(pass, 0, "/mnt/nas1/bak", 1, "/mnt/nas/bak", "/bak");
FindFile ff(dir + "/*");
d = Date::Low();
Time tm = Time::Low();
int64 len = 0;
String fn;
while(ff) {
if(ff.IsFile()) {
Date d1 = (Date)Time(ff.GetLastWriteTime());
if(d1 > d) {
d = d1;
Time tm1 = Time(ff.GetLastWriteTime());
if(tm1 > tm) {
tm = tm1;
len = ff.GetLength();
fn = ff.GetName();
fn = ff.GetPath();
}
}
ff.Next();
}
len = len >> 20;
LOG(dir << ": " << fn << ", last date: " << d << ", size " << len << " MB");
LOG(fn << ", last time: " << tm << ", size " << len << " MB");
ASSERT(tm >= GetSysDate() - 1);
ASSERT(len > 2000 && len < 2800);
String h = Sys("tar -tvf " + fn);
int q = h.Find("root/website.bak/root/bak/forum.fud");
ASSERT(q >= 17);
String s = h.Mid(q - 17, 17);
Date d;
// 2014-10-30 01:01:56
// 0123456789012345678
d.year = atoi(s);
d.month = atoi(~s + 5);
d.day = atoi(~s + 8);
LOG("forum.fud last date: " << d);
ASSERT(d >= GetSysDate() - 1);
ASSERT(len > 500 && len < 1500);
}
@ -59,4 +72,6 @@ CONSOLE_APP_MAIN
int n = atoi(~s + q - 3);
LOG("Filesystem uses " << n << "%");
ASSERT(n > 10 && n < 85);
LOG("------------------- OK");
}