Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ DEPS := $(OBJS:.o=.d)

.PHONY: all clean rebuild dobby deploy dylib dylib-install sigcheck fonts fonts-install app-payload app app-zip \
anchorcheck callscheck sigdb-fixtures webpatch-fixtures peicon-fixtures panel-behavior app-tests \
featcheck featstagecheck \
featcheck featstagecheck runnervariantcheck conf-fixtures confcheck \
tests-list overlay-shim overlay-shim-install overlay-shim-tests \
overlay-shim-bench iconmaker icon \
appinfo helpers-install ntdll-resolve bridge runcheck compatcheck \
Expand Down Expand Up @@ -128,6 +128,11 @@ featstagecheck:
$(call SKIP,featstagecheck,dylib/tests/featstagecheck.sh); exit 0; fi; \
sh dylib/tests/featstagecheck.sh dylib/feats/compat_run.sh

runnervariantcheck:
@if [ ! -f dylib/tests/runnervariantcheck.sh ]; then \
$(call SKIP,runnervariantcheck,dylib/tests/runnervariantcheck.sh); exit 0; fi; \
sh dylib/tests/runnervariantcheck.sh dylib/feats/compat_run.sh

gamedrivecheck:
@if [ ! -f dylib/tests/gamedrivecheck.sh ]; then $(call SKIP,gamedrivecheck,dylib/tests/gamedrivecheck.sh); exit 0; fi; \
sh dylib/tests/gamedrivecheck.sh dylib/feats/compat_run.sh
Expand Down Expand Up @@ -223,6 +228,33 @@ callscheck:
@if [ ! -f dylib/tests/callscheck.c ]; then $(call SKIP,callscheck,dylib/tests/callscheck.c); exit 0; fi; \
$(MAKE) -s $(CALLSCHECK) && $(CALLSCHECK)

CONF_FIXTURES := dylib/tests/conf-fixtures
CONFDUMP := $(OUT_DIR)/confdump

$(CONFDUMP): dylib/tests/confdump.c dylib/feats/conf.c dylib/feats/conf.h
@mkdir -p $(dir $@)
$(TEST_CC) -O1 -o $@ dylib/tests/confdump.c

# One corpus, both readers: webpatch.c through confdump, compat_run.sh through its own
# normaliser. A difference between them is a difference between the panel and the launch.
conf-fixtures:
@if [ ! -d $(CONF_FIXTURES) ] || [ ! -f dylib/tests/confdump.c ]; then \
$(call SKIP,conf-fixtures,$(CONF_FIXTURES)); exit 0; fi; \
$(MAKE) -s $(CONFDUMP) || exit 1; \
tmp=$$(mktemp -d); \
grep -v '^\#' $(CONF_FIXTURES)/EXPECTED | grep -v '^$$' > $$tmp/want; \
$(CONFDUMP) $(CONF_FIXTURES) > $$tmp/got || { rm -rf $$tmp; exit 1; }; \
if ! diff -u $$tmp/want $$tmp/got > $$tmp/diff; then \
echo "FAIL: webpatch.c's reader does not read the corpus as EXPECTED says"; \
head -40 $$tmp/diff; rm -rf $$tmp; exit 1; fi; \
n=$$(grep -c . $$tmp/got); rm -rf $$tmp; \
echo "==> conf fixtures: $$n normalised lines match EXPECTED"

confcheck:
@if [ ! -f dylib/tests/confcheck.sh ]; then \
$(call SKIP,confcheck,dylib/tests/confcheck.sh); exit 0; fi; \
sh dylib/tests/confcheck.sh dylib/feats/compat_run.sh $(CONF_FIXTURES)

SIGDB_FIXTURES := dylib/tests/sigdb-fixtures

sigdb-fixtures:
Expand Down Expand Up @@ -267,19 +299,22 @@ GATECHECK := $(OUT_DIR)/gatecheck
FEATCHECK := $(OUT_DIR)/featcheck
WEBPATCH_FIXTURES := dylib/tests/webpatch-fixtures

$(GATECHECK): dylib/tests/gatecheck.c dylib/feats/webpatch.c dylib/feats/webpatch.h
$(GATECHECK): dylib/tests/gatecheck.c dylib/feats/webpatch.c dylib/feats/webpatch.h \
dylib/util/file.c
@mkdir -p $(dir $@)
$(TEST_CC) -O1 -o $@ dylib/tests/gatecheck.c
$(TEST_CC) -O1 -o $@ dylib/tests/gatecheck.c dylib/util/file.c

NATIVEPLATFORMCHECK := $(OUT_DIR)/nativeplatformcheck

$(NATIVEPLATFORMCHECK): dylib/tests/nativeplatformcheck.c dylib/feats/nativeplatform.c dylib/feats/nativeplatform.h dylib/util/file.c
@mkdir -p $(dir $@)
$(TEST_CC) -O1 -DHELPER_TIMEOUT_MS=1000 -o $@ dylib/tests/nativeplatformcheck.c dylib/feats/nativeplatform.c dylib/util/file.c

$(FEATCHECK): dylib/tests/featcheck.c dylib/feats/webpatch.c dylib/feats/webpatch.h
$(FEATCHECK): dylib/tests/featcheck.c dylib/feats/webpatch.c dylib/feats/webpatch.h \
dylib/feats/conf.c dylib/feats/conf.h \
dylib/util/file.c
@mkdir -p $(dir $@)
$(TEST_CC) -O1 -o $@ dylib/tests/featcheck.c
$(TEST_CC) -O1 -o $@ dylib/tests/featcheck.c dylib/util/file.c

featcheck:
@if [ ! -f dylib/tests/featcheck.c ]; then \
Expand Down Expand Up @@ -386,7 +421,7 @@ panel-behavior:
echo "==> panel-behavior: node not found, skipped"; exit 0; fi; \
mkdir -p $(OUT_DIR) && \
$(TEST_CC) -O1 -o $(OUT_DIR)/panel-emit \
$(PANEL_TESTS)/emit.c && \
$(PANEL_TESTS)/emit.c dylib/util/file.c && \
node $(PANEL_TESTS)/behavior.js $(OUT_DIR)/panel-emit && \
node $(PANEL_TESTS)/switching.js $(OUT_DIR)/panel-emit && \
node $(PANEL_TESTS)/launch-options.js $(OUT_DIR)/panel-emit && \
Expand Down
16 changes: 16 additions & 0 deletions dylib/feats/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,22 @@ const char *np_compat_fallback_tool_name(void) {
return g_tool_count > 0 ? g_tools[0].name : TOOL_DIR_NAME;
}

// collects every installed tool, the CrossOver build it runs and its architecture target(s).
// The panel needs all three to work out which runner variants it can offer for a game.
size_t np_compat_tool_builds(const char **names, const char **builds, const char **archs,
size_t max) {
load_tool_list_once();
size_t n = 0;
for (int i = 0; i < g_tool_count && n < max; i++) {
if (!*g_tools[i].build) continue;
names[n] = g_tools[i].name;
builds[n] = g_tools[i].build;
archs[n] = strcmp(g_tools[i].flavor, "fex") == 0 ? "aarch64" : "x86_64";
n++;
}
return n;
}

size_t np_compat_fex_tools(const char **names, size_t max) {
load_tool_list_once();
size_t n = 0;
Expand Down
2 changes: 2 additions & 0 deletions dylib/feats/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ const char *np_compat_fallback_tool_name(void);

// Names of the listed tools whose flavor is fex, up to max. Returns how many it wrote.
size_t np_compat_fex_tools(const char **names, size_t max);
size_t np_compat_tool_builds(const char **names, const char **builds, const char **archs,
size_t max);

uint32_t np_compat_manager_tools_max(void);

Expand Down
Loading
Loading