Esempio n. 1
0
void TestQPrefGeneral::test_set_struct()
{
	// Test set func -> struct pref

	auto tst = qPrefGeneral::instance();

	tst->set_auto_recalculate_thumbnails(false);
	tst->set_default_cylinder("new base21");
	tst->set_default_filename("new base22");
	tst->set_default_file_behavior(LOCAL_DEFAULT_FILE);
	tst->set_defaultsetpoint(24);
	tst->set_extract_video_thumbnails(false);
	tst->set_extract_video_thumbnails_position(25);
	tst->set_ffmpeg_executable("new base26");
	tst->set_o2consumption(27);
	tst->set_pscr_ratio(28);
	tst->set_use_default_file(false);
	tst->set_diveshareExport_uid("uid1");
	tst->set_diveshareExport_private(false);

	QCOMPARE(prefs.auto_recalculate_thumbnails, false);
	QCOMPARE(QString(prefs.default_cylinder), QString("new base21"));
	QCOMPARE(QString(prefs.default_filename), QString("new base22"));
	QCOMPARE(prefs.default_file_behavior, LOCAL_DEFAULT_FILE);
	QCOMPARE(prefs.defaultsetpoint, 24);
	QCOMPARE(prefs.extract_video_thumbnails, false);
	QCOMPARE(prefs.extract_video_thumbnails_position, 25);
	QCOMPARE(QString(prefs.ffmpeg_executable), QString("new base26"));
	QCOMPARE(prefs.o2consumption, 27);
	QCOMPARE(prefs.pscr_ratio, 28);
	QCOMPARE(prefs.use_default_file, false);
	QCOMPARE(tst->diveshareExport_uid(), QString("uid1"));
	QCOMPARE(tst->diveshareExport_private(), false);
}
Esempio n. 2
0
void TestQPrefGeneral::test_oldPreferences()
{
	auto general = qPrefGeneral::instance();

	general->set_default_filename("filename");
	general->set_default_cylinder("cylinder_2");
	general->set_default_file_behavior(LOCAL_DEFAULT_FILE);
	general->set_defaultsetpoint(0);
	general->set_o2consumption(0);
	general->set_pscr_ratio(0);
	general->set_use_default_file(true);

	TEST(general->default_filename(), QStringLiteral("filename"));
	TEST(general->default_cylinder(), QStringLiteral("cylinder_2"));
	TEST(general->default_file_behavior(), LOCAL_DEFAULT_FILE); // since we have a default file, here it returns
	TEST(general->defaultsetpoint(), 0);
	TEST(general->o2consumption(), 0);
	TEST(general->pscr_ratio(), 0);
	TEST(general->use_default_file(), true);

	general->set_default_filename("no_file_name");
	general->set_default_cylinder("cylinder_1");
	//TODOl: Change this to a enum.
	general->set_default_file_behavior(CLOUD_DEFAULT_FILE);

	general->set_defaultsetpoint(1);
	general->set_o2consumption(1);
	general->set_pscr_ratio(1);
	general->set_use_default_file(false);

	TEST(general->default_filename(), QStringLiteral("no_file_name"));
	TEST(general->default_cylinder(), QStringLiteral("cylinder_1"));
	TEST(general->default_file_behavior(), CLOUD_DEFAULT_FILE);
	TEST(general->defaultsetpoint(), 1);
	TEST(general->o2consumption(), 1);
	TEST(general->pscr_ratio(), 1);
	TEST(general->use_default_file(), false);
}
Esempio n. 3
0
void TestQPrefGeneral::test_set_load_struct()
{
	// test set func -> load -> struct pref

	auto tst = qPrefGeneral::instance();

	tst->set_auto_recalculate_thumbnails(true);
	tst->set_default_cylinder("new base31");
	tst->set_default_filename("new base32");
	tst->set_default_file_behavior(NO_DEFAULT_FILE);
	tst->set_defaultsetpoint(34);
	tst->set_extract_video_thumbnails(true);
	tst->set_extract_video_thumbnails_position(35);
	tst->set_ffmpeg_executable("new base36");
	tst->set_o2consumption(37);
	tst->set_pscr_ratio(38);
	tst->set_use_default_file(true);
	tst->set_diveshareExport_uid("uid2");
	tst->set_diveshareExport_private(true);

	prefs.auto_recalculate_thumbnails = false;
	prefs.default_cylinder = copy_qstring("error");
	prefs.default_filename = copy_qstring("error");
	prefs.default_file_behavior = UNDEFINED_DEFAULT_FILE;
	prefs.defaultsetpoint = 14;
	prefs.extract_video_thumbnails = false;
	prefs.extract_video_thumbnails_position = 15;
	prefs.ffmpeg_executable = copy_qstring("error");
	prefs.o2consumption = 17;
	prefs.pscr_ratio = 18;
	prefs.use_default_file = false;

	tst->load();
	QCOMPARE(prefs.auto_recalculate_thumbnails, true);
	QCOMPARE(QString(prefs.default_cylinder), QString("new base31"));
	QCOMPARE(QString(prefs.default_filename), QString("new base32"));
	QCOMPARE(prefs.default_file_behavior, NO_DEFAULT_FILE);
	QCOMPARE(prefs.defaultsetpoint, 34);
	QCOMPARE(prefs.extract_video_thumbnails, true);
	QCOMPARE(prefs.extract_video_thumbnails_position, 35);
	QCOMPARE(QString(prefs.ffmpeg_executable), QString("new base36"));
	QCOMPARE(prefs.o2consumption, 37);
	QCOMPARE(prefs.pscr_ratio, 38);
	QCOMPARE(prefs.use_default_file, true);
	QCOMPARE(tst->diveshareExport_uid(), QString("uid2"));
	QCOMPARE(tst->diveshareExport_private(), true);
}
Esempio n. 4
0
/*ARGSUSED*/
int
main(void *cookie, char **argv, int argc)
{
	/*
	 * bpath is the boot device path buffer.
	 * bargs is the boot arguments buffer.
	 */
	static char	bpath[OBP_MAXPATHLEN], bargs[OBP_MAXPATHLEN];
	boolean_t	user_specified_filename;

	prom_init("boot", cookie);
	fiximp();

	system_check();

	dprintf("\nboot: V%d /boot interface.\n", BO_VERSION);
#ifdef HALTBOOT
	prom_enter_mon();
#endif /* HALTBOOT */

	init_memlists();

#ifdef DEBUG_LISTS
	dprintf("Physmem avail:\n");
	if (debug) print_memlist(pfreelistp);
	dprintf("Virtmem avail:\n");
	if (debug) print_memlist(vfreelistp);
	dprintf("Phys installed:\n");
	if (debug) print_memlist(pinstalledp);
	prom_enter_mon();
#endif /* DEBUG_LISTS */

	/*
	 * Initialize the default filename (exported as "default-name" and
	 * used by kadb).
	 */
	set_default_filename(defname);

	/*
	 * Parse the arguments ASAP in case there are any flags which may
	 * affect execution.
	 */

	/*
	 * filename is the path to the standalone.  Initialize it to the empty
	 * string so we can tell whether the user specified it in the
	 * arguments.
	 */
	filename[0] = '\0';

	/*
	 * Fetch the boot arguments from the PROM and split the filename off
	 * if it's there.
	 */
	init_bootargs(filename, sizeof (filename), bargs, sizeof (bargs));

	/*
	 * kadb was delivered as a standalone, and as such, people got used to
	 * typing `boot kadb'.  kmdb isn't a standalone - it is loaded by krtld
	 * as just another kernel module.  For compatibility, though, when we
	 * see an attempt to `boot kadb' or `boot kmdb', we'll transform that
	 * into a `boot -k' (or equivalent).
	 */
	if (strcmp(filename, "kmdb") == 0 || strcmp(filename, "kadb") == 0) {
		boothowto |= RB_KMDB;
		*filename = '\0'; /* let boot figure out which unix to use */
	}

	bootflags(bargs, sizeof (bargs));

	user_specified_filename = (filename[0] != '\0');

	/* Fetch the boot path from the PROM. */
	(void) strncpy(bpath, prom_bootpath(), sizeof (bpath) - 1);
	bpath[sizeof (bpath) - 1] = '\0';

	dprintf("arch: %s\n", is_sun4v ? "sun4v" : "sun4u");
	dprintf("bootpath: 0x%p %s\n", (void *)bpath, bpath);
	dprintf("bootargs: 0x%p %s\n", (void *)bargs, bargs);
	dprintf("filename: 0x%p %s\n", (void *)filename, filename);
	dprintf("kernname: 0x%p %s\n", (void *)kernname, kernname);

	/*
	 * *v2path will be exported to the standalone as the boot-path boot
	 * property.
	 */
	v2path = bpath;

	/*
	 * Our memory lists should be "up" by this time
	 */

	setup_bootops();

	/*
	 * If bpath is a network card, set v2path to a copy of bpath with the
	 * options stripped off.
	 */
	mangle_os_bootpath(bpath);

	/*
	 * Not necessary on sun4v as nvram is virtual
	 * and kept by the guest manager on the SP.
	 */
	if (!is_sun4v) {
		retain_nvram_page();
	}

	if (bootprog(bpath, bargs, user_specified_filename) == 0) {
		post_mountroot(filename, NULL);
		/*NOTREACHED*/
	}

	return (0);
}
Esempio n. 5
0
int
setup_root_vars(void)
{
	size_t		buflen;
	uint16_t	readsize;

	/*
	 * Root server name. Required.
	 */
	buflen = sizeof (root_hostname);
	if (dhcp_getinfo(DSYM_VENDOR, VS_NFSMNT_ROOTSRVR_NAME, 0,
	    root_hostname, &buflen)) {
		root_hostname[buflen] = '\0';
	} else {
		dprintf("BOUND: Missing Root Server Name Option\n");
		errno = EINVAL;
		return (-1);
	}

	/*
	 * Root server IP. Required.
	 */
	buflen = sizeof (root_to.sin_addr);
	if (!dhcp_getinfo(DSYM_VENDOR, VS_NFSMNT_ROOTSRVR_IP, 0,
	    &root_to.sin_addr, &buflen)) {
		dprintf("BOUND: Missing Root Server IP Option\n");
		errno = EINVAL;
		return (-1);
	}

	/*
	 * Root path Required.
	 */
	buflen = sizeof (root_pathbuf);
	if (dhcp_getinfo(DSYM_VENDOR, VS_NFSMNT_ROOTPATH, 0,
	    root_pathbuf, &buflen)) {
		root_pathbuf[buflen] = '\0';
	} else {
		dprintf("BOUND: Missing Root Path Option\n");
		errno = EINVAL;
		return (-1);
	}

	/*
	 * Optional Bootfile path.
	 */
	buflen = sizeof (root_boot_file);
	if (dhcp_getinfo(DSYM_VENDOR, VS_NFSMNT_BOOTFILE, 0,
		    root_boot_file, &buflen)) {
		root_boot_file[buflen] = '\0';
		dprintf("BOUND: Optional Boot File is: %s\n", root_boot_file);
	}

	/* if we got a boot file name, use it as the default */
	if (root_boot_file[0] != '\0')
		set_default_filename(root_boot_file);

	/*
	 * Set the NFS read size. The mount code will adjust it to
	 * the maximum size.
	 */
	buflen = sizeof (readsize);
	if (dhcp_getinfo(DSYM_VENDOR, VS_BOOT_NFS_READSIZE, 0,
	    &readsize, &buflen)) {
		nfs_readsize = ntohs(readsize);
		if (boothowto & RB_VERBOSE) {
			printf("Boot NFS read size: %d\n", nfs_readsize);
		}
	}

	/*
	 * Optional rootopts.
	 */
	buflen = sizeof (rootopts);
	if (dhcp_getinfo(DSYM_VENDOR, VS_NFSMNT_ROOTOPTS, 0,
	    rootopts, &buflen)) {
		rootopts[buflen] = '\0';
		dprintf("BOUND: Optional Rootopts is: %s\n", rootopts);
	}

	return (0);
}