PROCESS_THREAD(example_coffee_process, ev, data)
{
  PROCESS_BEGIN();

#define SDCARD

#ifdef SDCARD
	uSDcard_init();
	printf("sdcard initialised.\n");
#endif

#if NEED_FORMATTING
  cfs_coffee_format();
#endif

  /* Ensure that we will be working with a new file. */
  cfs_remove(FILENAME);

  if (file_test(FILENAME, "The first test") == 0) {
    printf("file test 1 failed\n");
  }
  if (file_test(FILENAME, "The second test") == 0) {
    printf("file test 2 failed\n");
  }
  if (dir_test() == 0) {
    printf("dir test failed\n");
  }

  PROCESS_END();
}
    void PlayerFor(const QString &filename, const VideoMetadata *extraData = nullptr)
    {
        QString extension = filename.section(".", -1, -1);
        QDir dir_test(QString("%1/VIDEO_TS").arg(filename));
        if (dir_test.exists())
            extension = "VIDEO_TS";
        QDir bd_dir_test(QString("%1/BDMV").arg(filename));
        if (bd_dir_test.exists())
            extension = "BDMV";

        QString play_command = gCoreContext->GetSetting("VideoDefaultPlayer");

        const FileAssociations::association_list fa_list =
                FileAssociations::getFileAssociation().getList();
        for (FileAssociations::association_list::const_iterator p =
                fa_list.begin(); p != fa_list.end(); ++p)
        {
            if (p->extension.toLower() == extension.toLower() &&
                    !p->use_default)
            {
                play_command = p->playcommand;
                break;
            }
        }

        if (play_command.trimmed().isEmpty())
            play_command = "Internal";

        QString plot;
        QString title = VideoMetadata::FilenameToMeta(filename, 1);
        QString subtitle = VideoMetadata::FilenameToMeta(filename, 4);
        QString director;
        int season = 0;
        int episode = 0;
        QString inetref;
        int length = 0;
        QString year = QString::number(VIDEO_YEAR_DEFAULT);
        QString id;

        if (extraData)
        {
            plot = extraData->GetPlot();
            title = extraData->GetTitle();
            subtitle = extraData->GetSubtitle();
            director = extraData->GetDirector();
            season = extraData->GetSeason();
            episode = extraData->GetEpisode();
            inetref = extraData->GetInetRef();
            length = extraData->GetLength();
            year = QString::number(extraData->GetYear());
            id = QString::number(extraData->GetID());
        }

        AddPlayer(play_command, filename, plot, title, subtitle, director,
                                season, episode, inetref, length, year, id);
    }
Beispiel #3
0
int
main(int argc, char * argv[])
{
	int tv = 0;

	if (argc > 1) {
		if (*argv[1]=='1') {
			tv = RUNBIGFILE;
		}
		else if (*argv[1]=='2') {
			tv = RUNDIRTEST;
		}
		else if (*argv[1]=='3') {
			tv = RUNCONCUR;
		}
	}
	else {
		tv = RUNTHEMALL;
	}

	if (tv & RUNBIGFILE) {
		printf("[BIGFILE] : Run #1\n");
		big_file(BIGFILE_SIZE);
		printf("[BIGFILE] : Run #2\n");
		big_file(BIGFILE_SIZE);
	}

	if (tv & RUNDIRTEST) {
		printf("[DIRTEST] : Run #1\n");
		dir_test(DIR_DEPTH);
		printf("[DIRTEST] : Run #2\n");
		dir_test(DIR_DEPTH);
	}

	if (tv & RUNCONCUR) {
		printf("[CONCUR]\n");
		concur();
	}
	return 0;
}
Beispiel #4
0
int main(int argc, char *argv[])
{
    ext2_filsys		fs;
    struct ext2_super_block param;
    errcode_t		retval;
    int			i;

    /* setup */
    initialize_ext2_error_table();

    memset(&param, 0, sizeof(param));
    ext2fs_blocks_count_set(&param, 32768);
    param.s_inodes_count = 100;

    param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_INLINE_DATA;
    param.s_rev_level = EXT2_DYNAMIC_REV;
    param.s_inode_size = 256;

    retval = ext2fs_initialize("test fs", EXT2_FLAG_64BITS, &param,
                               test_io_manager, &fs);
    if (retval) {
        com_err("setup", retval,
                "while initializing filesystem");
        exit(1);
    }

    retval = ext2fs_allocate_tables(fs);
    if (retval) {
        com_err("setup", retval,
                "while allocating tables for test filesysmte");
        exit(1);
    }

    /* initialize inode cache */
    if (!fs->icache) {
        struct ext2_inode inode;
        ext2_ino_t first_ino = EXT2_FIRST_INO(fs->super);
        int i;

        /* we just want to init inode cache.  So ignore error */
        ext2fs_create_inode_cache(fs, 16);
        if (!fs->icache) {
            fprintf(stderr,
                    "tst_inline_data: init inode cache failed\n");
            exit(1);
        }

        /* setup inode cache */
        for (i = 0; i < fs->icache->cache_size; i++)
            fs->icache->cache[i].ino = first_ino++;
    }

    /* test */
    if (file_test(fs)) {
        fprintf(stderr, "tst_inline_data(FILE): FAILED\n");
        return 1;
    }
    printf("tst_inline_data(FILE): OK\n");

    if (dir_test(fs)) {
        fprintf(stderr, "tst_inline_data(DIR): FAILED\n");
        return 1;
    }
    printf("tst_inline_data(DIR): OK\n");

    return 0;
}