int main() 
{
    int testnumber = 1;
	int count      = 0;

    if((fp = fopen("ZS_WritebackStoreMode6.log", "w+")) == 0)
    {
        fprintf(stderr, " open log file failed!.\n");
        return -1;
    }

    ZSSetProperty("ZS_STRICT_WRITEBACK", "On");
    ZSSetProperty("ZS_MAX_OUTSTANDING_BACKGROUND_FLUSHES", "0");
    ZSSetProperty("ZS_CACHE_SIZE", "100000000");
    if (ZS_SUCCESS == pre_env())
    {
        for(uint32_t aw = 0; aw < 1; aw++)
        {
            count += test_invalid_para(aw);
    	    count += test_basic_check(aw);
         }
         clear_env();
    }
    fclose(fp);
  
    fprintf(stderr, "Test Result:\n");
    for(int aw = 0; aw < 1; aw++)
    {
        if(0 == aw)
        {
            fprintf(stderr, "***** When disable async write: *****\n");
        }else{
            fprintf(stderr, "***** When enable async write: *****\n");
        }
        for(int i = 0; i < testnumber; i++)
        {
	    int j_end = (i == 0) ? 6 : 10;
            fprintf(stderr, "%s\n", testname[i]);
            for(int j = 0; j < j_end; j++)
            {
            if(result[aw][i][j] == 1)
            {
                fprintf(stderr, "[mode fifo=%d/persist=%d/evict=%d/writethru=%d] pass\n",mode[j][0],mode[j][1],mode[j][2],mode[j][3]);
            }else{
                fprintf(stderr, "[mode fifo=%d/persist=%d/evict=%d/writethru=%d] fail\n",mode[j][0],mode[j][1],mode[j][2],mode[j][3]);
            }
        }
    }
   }
   if(testnumber*2 == count)
   {
      fprintf(stderr, "#Test of ZSWritebackStoreMode6 pass!\n");
   }else{
      fprintf(stderr, "#Test of ZSWritebackStoreMode6 fail!\n");
   }
   return (!(testnumber*2 == count));
}
int main()
{
    int testnumber = 4;
    int count      = 0;

    if((fp = fopen("ZS_FlushObject.log", "w+")) == 0)
    {
        fprintf(stderr, " open log file failed!.\n");
        return -1;
    }

    if(ZS_SUCCESS == pre_env())
    {
        for(uint32_t aw = 0; aw < 2; aw++)
        {
//            count += test_invalid_cguids(aw);
//            count += test_invalid_object(aw);
//            count += test_invalid_key_keylen(aw);
            count += test_basic_check_1(aw);
        }
        clear_env();
    }
    fclose(fp);

    fprintf(stderr, "Test Result:\n");

    for(int aw = 0; aw < 2; aw++)
    {
        if(0 == aw)
        {
            fprintf(stderr, "***** When disable async write: *****\n");
        } else {
            fprintf(stderr, "***** When enable async write: *****\n");
        }
        for(int i = 0; i < testnumber; i++)
        {
            if(NULL != testname[i])
            {
                fprintf(stderr, "%s\n", testname[i]);
                for(int j = 0; j < 3; j++)
                {
                    if(result[aw][i][j] == 1)
                    {
                        fprintf(stderr, "[durability type = %d] pass\n",j);
                    } else {
                        fprintf(stderr, "[durability type = %d] fail\n",j);
                    }
                }
            }
        }
    }

    if(1*2 == count)
    {
        fprintf(stderr, "#Test of ZSFlushObject pass!\n");
        fprintf(stderr, "#The related test script is ZS_FlushObject.c\n");
        fprintf(stderr, "#If you want, you can check test details in ZS_FlushObject.log\n");
    } else {
        fprintf(stderr, "#Test of ZSFlushObject fail!\n");
        fprintf(stderr, "#The related test script is ZS_FlushObject.c\n");
        fprintf(stderr, "#If you want, you can check test details in ZS_FlushObject.log\n");
    }

    return (!(1*2 == count));
}
static int32_t
mgr1()
{
	ZS_status_t ret = ZS_SUCCESS;

	fprintf(fp, "%s", "****** Test 1 *****\n");

	/*
	 * Init ZS
	 */
	ret = pre_env();

	if (ZS_SUCCESS != ret) {
		fprintf(fp, "pre_env failed with err=%s\n", ZSStrError(ret));
		return -1;
	}

	/*
	 * Create a container
	 */
	uint32_t flag = ZS_CTNR_CREATE; //ZS_CTNR_RO_MODE
	uint32_t dura = ZS_DURABILITY_PERIODIC;
	char cname[1024] = {'\0'};

	uint32_t i;
	int32_t r = 0;
	int32_t count = 0;

	sprintf(cname, "test_%d", 0);

	do {
		ret = OpenContainer(cname, flag, dura, &cguid);

		/*
		 * Start high frequency I/O
		 */
		for (i = 0; i < MAX_ITERATION; i++)
		{
			r = rand() % 16 + 1;
			if (0 == (r % 7)) {
				fprintf(fp, "Random failure at %d\n", r);
				goto exit_mgr1;	
			}

			ret = io();
			if (ZS_SUCCESS != ret) {
				fprintf(fp, "io failed with err=%s\n", ZSStrError(ret));
				goto exit_mgr1;
			}
		}

		ret = DeleteContainer(cguid);
		if (ZS_SUCCESS != ret) {
			fprintf(fp, "DeleteContainer failed with err=%s\n", ZSStrError(ret));
			goto exit_mgr1;
		}

		count++;
	} while (count < 5);

exit_mgr1:
	/*
	 * Start graceful shutdown
	 */
	fprintf(fp, "%s", "Starting graceful shutdown\n");
	ret = clear_env();
	fprintf(fp, "Shutdown returned %s:\n", ZSStrError(ret));

	if (ZS_SUCCESS != ret) {
		fprintf(fp, "%s", "Graceful shutdown test1 failed\n");
		return 1;
	}

	/*
	 * Attempt another shutdown
	 */
	fprintf(fp, "%s", "Attempt another shutdown\n");
	ret = ZSShutdown(zs_state);
	fprintf(fp, "Next shutdown returned %s:\n", ZSStrError(ret));

	if (ZS_SUCCESS == ret) {
		fprintf(fp, "%s", "Next shutdown test2 failed\n");	
		return 1;
	}

    /*
	 * Perform I/O and container ops after shutdown
	 * It should fail
	 */
	ret = io();
	fprintf(fp, "Post shutdown: I/O failed with %s\n", ZSStrError(ret));

	if (ZS_SUCCESS == ret) {
		fprintf(fp, "%s", "Post shutdown: I/O test3 failed\n");	
		return 1;
	}

	/*
	 * Perform container ops: It should fail
	 */
	ret = container_ops(cname, flag, dura);
	fprintf(fp, "Post shutdown: container ops returns %s\n", ZSStrError(ret));

	if (ZS_SUCCESS == ret) {
		fprintf(fp, "%s", "Post shutdown: container ops test4 failed\n");	
		return 1;
	}

	return 0;
}
}

void MySetting::cnstrct_logo() {
	logo = new QLabel(this);
	logo->setPixmap(QPixmap(MyRes::logo_add));
	logo->setAlignment(Qt::AlignHCenter);
	logo->setAttribute(Qt::WA_TranslucentBackground);
}

void MySetting::set_cnctns() {
	QObject::connect(modeTab->gMods, SIGNAL(buttonToggled(int, bool)), this, SLOT(update_stng()));
	QObject::connect(modeTab->gDiffs, SIGNAL(buttonToggled(int, bool)), this, SLOT(update_stng()));

	QObject::connect(thmTab->spc_prebtn, SIGNAL(clicked()), this, SLOT(pre_shp()));
	QObject::connect(thmTab->spc_nexbtn, SIGNAL(clicked()), this, SLOT(nxt_shp()));
	QObject::connect(thmTab->env_prebtn, SIGNAL(clicked()), this, SLOT(pre_env()));
	QObject::connect(thmTab->env_nexbtn, SIGNAL(clicked()), this, SLOT(nxt_env()));

	QObject::connect(audTab->sndEffs_sli, SIGNAL(valueChanged(int)), this, SLOT(update_stng()));
	QObject::connect(audTab->sndEffs_mute, SIGNAL(stateChanged(int)), this, SLOT(update_stng()));
	QObject::connect(audTab->muse_sli, SIGNAL(valueChanged(int)), this, SLOT(update_stng()));
	QObject::connect(audTab->muse_mute, SIGNAL(stateChanged(int)), this, SLOT(update_stng()));

	QObject::connect(aiTab->aiDiffs, SIGNAL(buttonToggled(int, bool)), this, SLOT(update_stng()));
	QObject::connect(aiTab->aiShip_prebtn, SIGNAL(clicked()), this, SLOT(pre_aishp()));
	QObject::connect(aiTab->aiShip_nexbtn, SIGNAL(clicked()), this, SLOT(nxt_aishp()));
}

void MySetting::update_stng() {
	if (modeTab->gMods->checkedId() == 3 && SettingData::gMode != 3) {
		aiTab->show();