コード例 #1
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_versions)
{
    HySack sack = test_globals.sack;
    unsigned epoch;
    char *version, *release;
    HyPackage pkg;

    pkg = by_name(sack, "baby");
    ck_assert_str_eq(hy_package_get_evr(pkg), "6:5.0-11");
    epoch = hy_package_get_epoch(pkg);
    fail_unless(epoch == 6);
    version = hy_package_get_version(pkg);
    ck_assert_str_eq(version, "5.0");
    hy_free(version);
    release = hy_package_get_release(pkg);
    ck_assert_str_eq(release, "11");
    hy_free(release);
    hy_package_free(pkg);

    pkg = by_name(sack, "jay");
    // epoch missing if it's 0:
    ck_assert_str_eq(hy_package_get_evr(pkg), "5.0-0");
    epoch = hy_package_get_epoch(pkg);
    fail_unless(epoch == 0);
    version = hy_package_get_version(pkg);
    ck_assert_str_eq(version, "5.0");
    hy_free(version);
    release = hy_package_get_release(pkg);
    ck_assert_str_eq(release, "0");
    hy_free(release);
    hy_package_free(pkg);
}
コード例 #2
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_two_sacks)
{
    /* This clumsily mimics create_ut_sack() and setup_with() to
     * create a second HySack. */
    char *tmpdir = solv_dupjoin(test_globals.tmpdir, "/tmp", NULL);
    HySack sack1 = hy_sack_create(tmpdir, TEST_FIXED_ARCH, NULL, NULL,
                                  HY_MAKE_CACHE_DIR);
    Pool *pool1 = sack_pool(sack1);
    const char *path = pool_tmpjoin(pool1, test_globals.repo_dir,
                                    "change.repo", NULL);
    fail_if(load_repo(pool1, "change", path, 0));
    HyPackage pkg1 = by_name(sack1, "penny-lib");
    fail_if(pkg1 == NULL);

    HySack sack2 = test_globals.sack;
    Pool *pool2 = sack_pool(sack2);
    HyPackage pkg2 = by_name(sack2, "penny-lib");
    fail_if(pkg2 == NULL);

    /* "penny-lib" is in both pools but at different offsets */
    Solvable *s1 = pool_id2solvable(pool1, pkg1->id);
    Solvable *s2 = pool_id2solvable(pool2, pkg2->id);
    fail_if(s1->name == s2->name);

    fail_if(hy_package_cmp(pkg1, pkg2) != 0);

    hy_package_free(pkg1);
    hy_package_free(pkg2);

    hy_sack_free(sack1);
    solv_free(tmpdir);
}
コード例 #3
0
ファイル: main.cpp プロジェクト: thompw4/HWserver
bool by_section(const Student *s1, const Student *s2) {
  if (s2->getIndependentStudy() == true && s1->getIndependentStudy() == false) return false;
  if (s2->getIndependentStudy() == false && s1->getIndependentStudy() == true) return false;
  if (s2->getSection() <= 0 && s1->getSection() <= 0) {
    return by_name(s1,s2);
  }
  if (s2->getSection() == 0) return true;
  if (s1->getSection() == 0) return false;
  if (s1->getSection() < s2->getSection()) return true;
  if (s1->getSection() > s2->getSection()) return false;
    return by_name(s1,s2);
}
コード例 #4
0
ファイル: groupman.cpp プロジェクト: Nerovi/LightOPC
STDMETHODIMP LightOPCServer::GetGroupByName(LPCWSTR szGroupName, REFIID riid, LPUNKNOWN *ppUnk)
{
 HRESULT hr = S_OK;
 LightOPCGroup *grp;

 LO_CHECK_STATEz1("GetGroupByName", ppUnk);
 UL_TRACE((LOG_SR("GetGroupByName(%ls)"), loWnul(szGroupName)));
 if (!ppUnk) hr = E_INVALIDARG;
 else
   {
    if (!szGroupName) hr = E_INVALIDARG;
    else
      {
       lock_read();
          hr = loOPC_E_NOTFOUND;
	  if (grp = by_name(szGroupName))
	    hr = grp->QueryInterface(riid, (LPVOID*)ppUnk);
       unlock();
      }
   }

 if (S_OK != hr) UL_INFO((LOG_SR("GetGroupByName(%ls) =%s"),
               loWnul(szGroupName), loStrError(hr)));
 else UL_NOTICE((LOG_SR("GetGroupByName(%ls) =%u /%p"),
			szGroupName, ((LightOPCGroup*)grp)->ServerHandle, *ppUnk));
 LO_FINISH();
 return hr;
}
コード例 #5
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_identical)
{
    HySack sack = test_globals.sack;
    HyPackage pkg1 = by_name(sack, "penny-lib");
    HyPackage pkg2 = by_name(sack, "flying");
    HyPackage pkg3 = by_name(sack, "penny-lib");

    fail_unless(hy_package_identical(pkg1, pkg3));
    fail_if(hy_package_identical(pkg2, pkg3));

    hy_package_free(pkg1);
    hy_package_free(pkg2);
    hy_package_free(pkg3);
}
コード例 #6
0
ファイル: test_package.c プロジェクト: zde/hawkey
END_TEST
START_TEST(test_packager)
{
    HyPackage pkg = by_name(test_globals.sack, "tour");
    ck_assert_str_eq(hy_package_get_packager(pkg), "roll up <*****@*****.**>");
    hy_package_free(pkg);
}
コード例 #7
0
ファイル: test_package.c プロジェクト: zde/hawkey
END_TEST

START_TEST(test_get_updateinfo)
{
    HyStringArray urls;
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "tour");

    fail_unless(hy_package_get_update_severity(pkg) == HY_UPDATE_SEVERITY_BUGFIX);
    fail_unless(strcmp(hy_package_get_update_name(pkg), "FEDORA-2008-9969") == 0);
    fail_unless(strcmp(hy_package_get_update_description(pkg), "An example update to the tour package.") == 0);

    /* test getting update URLs */
    urls = hy_package_get_update_urls_bugzilla(pkg);
    fail_unless(urls != NULL);
    fail_unless(urls[0] != NULL);
    fail_unless(urls[1] == NULL);
    fail_unless(strcmp(urls[0], "https://bugzilla.redhat.com/show_bug.cgi?id=472090") == 0);
    hy_stringarray_free(urls);

    urls = hy_package_get_update_urls_cve(pkg);
    fail_unless(urls != NULL);
    fail_unless(urls[0] != NULL);
    fail_unless(urls[1] == NULL);
    fail_unless(strcmp(urls[0], "https://bugzilla.gnome.com/show_bug.cgi?id=472091") == 0);
    hy_stringarray_free(urls);

    urls = hy_package_get_update_urls_vendor(pkg);
    fail_unless(urls != NULL);
    fail_unless(urls[0] == NULL);
    hy_stringarray_free(urls);

    hy_package_free(pkg);
}
コード例 #8
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

#define TOUR_45_46_DRPM_CHKSUM "\xc3\xc3\xd5\x72\xa4\x6b"\
    "\x1a\x66\x90\x6d\x42\xca\x17\x63\xef\x36\x20\xf7\x02"\
    "\x58\xaa\xac\x4c\x14\xbf\x46\x3e\xd5\x37\x16\xd4\x44"

START_TEST(test_presto)
{
    HySack sack = test_globals.sack;
    HyPackage tour = by_name(sack, "tour");
    fail_if(tour == NULL);

    HyPackageDelta delta = hy_package_get_delta_from_evr(tour, "4-5");
    const char *location = hy_packagedelta_get_location(delta);
    ck_assert_str_eq(location, "drpms/tour-4-5_4-6.noarch.drpm");
    const char *baseurl = hy_packagedelta_get_baseurl(delta);
    fail_unless(baseurl == NULL);
    unsigned long long size = hy_packagedelta_get_downloadsize(delta);
    ck_assert_int_eq(size, 3132);
    int type;
    HyChecksum *csum = hy_packagedelta_get_chksum(delta, &type);
    fail_unless(type == HY_CHKSUM_SHA256);
    ck_assert(!memcmp(csum, TOUR_45_46_DRPM_CHKSUM, 32));
    hy_packagedelta_free(delta);
    hy_package_free(tour);
}
コード例 #9
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_package_summary)
{
    HyPackage pkg = by_name(test_globals.sack, "penny-lib");
    fail_if(strcmp(hy_package_get_summary(pkg), "in my ears"));
    hy_package_free(pkg);
}
コード例 #10
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_sourcerpm)
{
    HyPackage pkg = by_name(test_globals.sack, "tour");
    char *sourcerpm = hy_package_get_sourcerpm(pkg);

    ck_assert_str_eq(sourcerpm, "tour-4-6.src.rpm");
    hy_free(sourcerpm);
    hy_package_free(pkg);

    pkg = by_name(test_globals.sack, "mystery-devel");
    sourcerpm = hy_package_get_sourcerpm(pkg);
    ck_assert_str_eq(sourcerpm, "mystery-19.67-1.src.rpm");
    hy_free(sourcerpm);
    hy_package_free(pkg);
}
コード例 #11
0
LLInventoryModel::item_array_t LLLandmarkActions::fetchLandmarksByName(std::string& name, BOOL use_substring)
{
	LLInventoryModel::cat_array_t cats;
	LLInventoryModel::item_array_t items;
	LLFetchLandmarksByName by_name(name, use_substring);
	fetch_landmarks(cats, items, by_name);

	return items;
}
コード例 #12
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_no_sourcerpm)
{
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "baby");
    char *src = hy_package_get_sourcerpm(pkg);

    fail_unless(src == NULL);
    hy_package_free(pkg);
}
コード例 #13
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_lookup_num)
{
    HyPackage pkg = by_name(test_globals.sack, "tour");
    unsigned long long buildtime = hy_package_get_buildtime(pkg);
    fail_unless(buildtime > 1330473600); // after 2012-02-29
    fail_unless(buildtime < 1456704000); // before 2016-02-29

    hy_package_free(pkg);
}
コード例 #14
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_get_more_requires)
{
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "walrus");
    HyReldepList reldeplist = hy_package_get_requires(pkg);

    fail_unless(hy_reldeplist_count(reldeplist) == 2);
    hy_reldeplist_free(reldeplist);
    hy_package_free(pkg);
}
コード例 #15
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_get_files_cmdline)
{
    HySack sack = test_globals.sack;

    HyPackage pkg = by_name(sack, "tour");
    HyStringArray files;

    files = hy_package_get_files(pkg);
    fail_unless(hy_stringarray_length(files) == 6);
    hy_stringarray_free(files);
    hy_package_free(pkg);
}
コード例 #16
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_chksum_fail)
{
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "walrus");
    int type;

    const unsigned char *chksum = hy_package_get_chksum(pkg, &type);
    fail_unless(chksum == NULL);
    chksum = hy_package_get_hdr_chksum(pkg, &type);
    fail_unless(chksum == NULL);
    hy_package_free(pkg);
}
コード例 #17
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_checksums)
{
    HyPackage pkg = by_name(test_globals.sack, "mystery-devel");
    int i;
    HyChecksum *csum = hy_package_get_chksum(pkg, &i);
    fail_unless(i == HY_CHKSUM_SHA256);
    // Check the first and last bytes. Those need to match against information
    // in primary.xml.gz.
    fail_unless(csum[0] == 0x2e);
    fail_unless(csum[31] == 0xf5);

    hy_package_free(pkg);
}
コード例 #18
0
ファイル: test_advisory.c プロジェクト: hutarova/hawkey
static void
advisory_fixture(void)
{
    fixture_yum();

    HyPackage pkg;
    HyAdvisoryList advisories;

    pkg = by_name(test_globals.sack, "tour");
    advisories = hy_package_get_advisories(pkg, HY_GT);

    advisory = hy_advisorylist_get_clone(advisories, 0);

    hy_advisorylist_free(advisories);
    hy_package_free(pkg);
}
コード例 #19
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_get_files)
{
    HySack sack = test_globals.sack;

    HyPackage pkg = by_name(sack, "tour");
    HyStringArray files = hy_package_get_files(pkg);
    char *f;
    int i;

    FOR_STRINGARRAY(f, files, i)
    ;
    fail_unless(i == 6);
    hy_stringarray_free(files);
    hy_package_free(pkg);
}
コード例 #20
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_get_advisories)
{
    HyAdvisoryList advisories;
    HyAdvisory advisory;
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "tour");

    advisories = hy_package_get_advisories(pkg, HY_GT);
    fail_unless(advisories != NULL);
    ck_assert_int_eq(hy_advisorylist_count(advisories), 1);
    advisory = hy_advisorylist_get_clone(advisories, 0);
    ck_assert_str_eq(hy_advisory_get_id(advisory), "FEDORA-2008-9969");
    hy_advisory_free(advisory);
    hy_advisorylist_free(advisories);
    hy_package_free(pkg);
}
コード例 #21
0
ファイル: test_query.c プロジェクト: mluscon/hawkey
END_TEST

START_TEST(test_filter_obsoletes)
{
    HySack sack = test_globals.sack;
    HyQuery q = hy_query_create(sack);
    HyPackageSet pset = hy_packageset_create(sack); // empty

    fail_if(hy_query_filter_package_in(q, HY_PKG_OBSOLETES, HY_EQ, pset));
    fail_unless(query_count_results(q) == 0);
    hy_query_clear(q);

    hy_packageset_add(pset, by_name(sack, "penny"));
    hy_query_filter_package_in(q, HY_PKG_OBSOLETES, HY_EQ, pset);
    fail_unless(query_count_results(q) == 1);

    hy_query_free(q);
    hy_packageset_free(pset);
}
コード例 #22
0
ファイル: test_query.c プロジェクト: mluscon/hawkey
END_TEST

START_TEST(test_query_reldep)
{
    HySack sack = test_globals.sack;
    HyPackage flying = by_name(sack, "flying");

    HyReldepList reldeplist = hy_package_get_requires(flying);
    HyReldep reldep = hy_reldeplist_get_clone(reldeplist, 0);

    HyQuery q = hy_query_create(test_globals.sack);
    fail_if(hy_query_filter_reldep(q, HY_PKG_PROVIDES, reldep));
    fail_unless(query_count_results(q) == 3);

    hy_reldep_free(reldep);
    hy_reldeplist_free(reldeplist);
    hy_package_free(flying);
    hy_query_free(q);
}
コード例 #23
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_get_requires)
{
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "flying");
    HyReldepList reldeplist = hy_package_get_requires(pkg);

    fail_unless(hy_reldeplist_count(reldeplist) == 1);
    HyReldep reldep = hy_reldeplist_get_clone(reldeplist, 0);

    char *depstr = hy_reldep_str(reldep);
    ck_assert_str_eq(depstr, "P-lib >= 3");
    hy_free(depstr);

    hy_reldep_free(reldep);
    hy_reldeplist_free(reldeplist);
    hy_package_free(pkg);
}
コード例 #24
0
ファイル: test_advisorypkg.cpp プロジェクト: edynox/libhif
static void
advisorypkg_fixture(void)
{
    fixture_yum();

    DnfPackage *pkg;
    GPtrArray *advisories;
    DnfAdvisory *advisory;
    GPtrArray *pkglist;

    pkg = by_name(test_globals.sack, "tour");
    advisories = dnf_package_get_advisories(pkg, HY_GT);
    advisory = static_cast<DnfAdvisory *>(g_ptr_array_index(advisories, 0));
    pkglist = dnf_advisory_get_packages(advisory);
    advisorypkg = static_cast<DnfAdvisoryPkg *>(g_ptr_array_index(pkglist, 0));

    g_ptr_array_unref(pkglist);
    g_ptr_array_unref(advisories);
    g_object_unref(pkg);
}
コード例 #25
0
ファイル: test_package.c プロジェクト: iamcourtney/hawkey
END_TEST

START_TEST(test_get_advisories_none)
{
    HyAdvisoryList advisories;
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "mystery-devel");

    advisories = hy_package_get_advisories(pkg, HY_GT|HY_EQ);
    fail_unless(advisories != NULL);
    ck_assert_int_eq(hy_advisorylist_count(advisories), 0);
    hy_advisorylist_free(advisories);

    advisories = hy_package_get_advisories(pkg, HY_LT|HY_EQ);
    fail_unless(advisories != NULL);
    ck_assert_int_eq(hy_advisorylist_count(advisories), 0);
    hy_advisorylist_free(advisories);

    hy_package_free(pkg);
}
コード例 #26
0
ファイル: test_package.c プロジェクト: zde/hawkey
END_TEST

START_TEST(test_presto)
{
    HySack sack = test_globals.sack;
    HyPackage tour = by_name(sack, "tour");
    fail_if(tour == NULL);

    HyPackageDelta delta = hy_package_get_delta_from_evr(tour, "4-5");
    const char *location = hy_packagedelta_get_location(delta);
    ck_assert_str_eq(location, "drpms/tour-4-5_4-6.noarch.drpm");
    const char *baseurl = hy_packagedelta_get_baseurl(delta);
    fail_unless(baseurl == NULL);
    unsigned long long size = hy_packagedelta_get_downloadsize(delta);
    ck_assert_int_eq(size, 3173);
    int type;
    HyChecksum *csum = hy_packagedelta_get_chksum(delta, &type);
    fail_unless(type == HY_CHKSUM_SHA256);
    fail_if(memcmp(csum, "\x8a\x5a\xfd\x4e\x08\xe9\xa3\x9a\xe3\xca\x9a\x2b\x49\xa0\xf8\x99\xa9\x70\x25\x26\x1d\x90\xff\xae\x14\x62\x06\x16\x86\x5b\x80\x7c", 32));
    hy_packagedelta_free(delta);
    hy_package_free(tour);
}
コード例 #27
0
ファイル: groupman.cpp プロジェクト: Nerovi/LightOPC
HRESULT LightOPCServer::internalAddGroup(
        LightOPCGroup *grp,
        LPCWSTR szName,
        BOOL bActive,
        DWORD UpdateRate,
        OPCHANDLE hClientGroup,
        LONG *pTimeBias,
        FLOAT *pPercentDeadband,
        DWORD dwLCID,
        OPCHANDLE *phServerGroup,
        REFIID riid,
        LPUNKNOWN *ppUnk
        )
{
 HRESULT hr = S_OK;
 unsigned servindex = 0;
 OPCHANDLE servhandle = 0;
 loWchar tname[loUNIQUE_LEN];

 if (phServerGroup) *phServerGroup = 0;
 if (!ppUnk) { hr = E_INVALIDARG; goto Exit; }
 *ppUnk = 0;

/*    if (!grp && !(grp = new LightOPCGroup()) ||
     grp->sstate != loST_READY) { hr = E_OUTOFMEMORY; goto Exit; }*/
/*  need assign all group atributes */
 grp->ClientHandle = hClientGroup;
 grp->UpdateRate = UpdateRate;
 grp->Active = bActive != 0;
 grp->Deadband = .0f;
 if (pPercentDeadband)
   {
    if (lo_IsNANf(*pPercentDeadband) ||
        *pPercentDeadband < 0. ||
        *pPercentDeadband > 100.) { hr = E_INVALIDARG; goto Exit; }
    grp->Deadband = *pPercentDeadband;
   }
 if (se->driver.ldCheckLocale && 
     se->driver.ldCheckLocale(&ctxt.cactx, dwLCID))
   GetLocaleID(&dwLCID);
 grp->grLCID = dwLCID;

 if (pTimeBias) grp->TimeBias = *pTimeBias;
 else
   {
    TIME_ZONE_INFORMATION tzi;
    tzi.Bias = 0;
    GetTimeZoneInformation(&tzi);
    grp->TimeBias = tzi.Bias;
   }

 if (szName)
   if (!*szName) szName = 0;
   else if (S_OK != grp->set_name(szName)) { hr = E_OUTOFMEMORY; goto Exit; }

// grp->sstate = loST_READY;
 hr = grp->QueryInterface(riid, (void**)ppUnk);
// grp->sstate = loST_DOWN;
 if (S_OK != hr) goto Exit;

 lock_write();
    if (!szName)
      {
       if (S_OK == (hr = mk_unique(tname, grp)))
         hr = grp->set_name(szName = tname);
      }
    else if (by_name(szName)) hr = OPC_E_DUPLICATENAME;

    if (S_OK == hr)
      if (servindex = add(grp))
        {
         do {
             if ((servhandle = ++unique_GroupHandle) == 0)
               servhandle = ++unique_GroupHandle;
            }
         while(by_handle(servhandle));

         grp->ServerHandle = servhandle;
         ostatus.dwGroupCount++;
        }
      else { hr = E_OUTOFMEMORY; /* delete grp; will be deleted by caller */ }
 unlock();

 if (phServerGroup) *phServerGroup = servhandle;

Exit:
 if (S_OK == hr)
   {
    UL_TRACE((LOG_SR("intAddGroup(%ls) i:%u h:%u /%p"),
              szName? szName: tname, servindex, servhandle, *ppUnk));
   }
 else
   {
     UL_TRACE((LOG_SR("intAddGroup(%ls) =%s"), loWnul(szName), loStrError(hr)));
//	 if (grp) delete grp;
    *ppUnk = 0;
   }

 return hr;
}
コード例 #28
0
ファイル: s4u_Mailbox.cpp プロジェクト: mpoquet/simgrid
MailboxPtr Mailbox::by_name(std::string name)
{
  return by_name(name.c_str());
}