newName = leafName + NS_LITERAL_CSTRING(".2");
newName = leafName; newName.Append(NS_LITERAL_CSTRING(".2"));
main(int argc, char* argv[]){    if (test_common_init(&argc, &argv) != 0)        return -1;    nsresult rv;    if (argc < 2) {        printf("usage: %s <file-to-read>\n", argv[0]);        return -1;    }    char* fileName = argv[1];    {        nsCOMPtr<nsIServiceManager> servMan;        NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);        nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);        NS_ASSERTION(registrar, "Null nsIComponentRegistrar");        if (registrar)            registrar->AutoRegister(nsnull);#if defined(PR_LOGGING)        gTestLog = PR_NewLogModule("Test");#endif        nsCOMPtr<nsIEventQueueService> eventQService =                 do_GetService(kEventQueueServiceCID, &rv);        if (NS_FAILED(rv)) return rv;        rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &gEventQ);        if (NS_FAILED(rv)) return rv;        nsCOMPtr<nsILocalFile> srcFile;        rv = NS_NewNativeLocalFile(nsDependentCString(fileName), PR_FALSE, getter_AddRefs(srcFile));        if (NS_FAILED(rv)) return rv;        nsCOMPtr<nsIFile> destFile;        rv = srcFile->Clone(getter_AddRefs(destFile));        if (NS_FAILED(rv)) return rv;        nsCAutoString leafName;        rv = destFile->GetNativeLeafName(leafName);        if (NS_FAILED(rv)) return rv;        nsCAutoString newName;        newName = leafName + NS_LITERAL_CSTRING(".1");        rv = destFile->SetNativeLeafName(newName);        if (NS_FAILED(rv)) return rv;        rv = RunTest(srcFile, destFile);        NS_ASSERTION(NS_SUCCEEDED(rv), "RunTest failed");        newName = leafName + NS_LITERAL_CSTRING(".2");        rv = destFile->SetNativeLeafName(newName);        if (NS_FAILED(rv)) return rv;        rv = RunBlockingTest(srcFile, destFile);        NS_ASSERTION(NS_SUCCEEDED(rv), "RunBlockingTest failed");        NS_RELEASE(gEventQ);        // give background threads a chance to finish whatever work they may        // be doing.        PR_Sleep(PR_SecondsToInterval(1));    } // this scopes the nsCOMPtrs    // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM    rv = NS_ShutdownXPCOM(nsnull);    NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");    return NS_OK;}