profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/jackrosenthal/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Jack Rosenthal jackrosenthal Google Boulder, CO http://jack.rosenth.al You can rent this space for only $5/week.

jackrosenthal/kajiki 34

Python XML-based template engine with Genshi-like syntax and Jinja-style blocks

jackrosenthal/algobowl 4

The web app that serves our competition-based group project for Algorithms courses

jackrosenthal/dunnet-cl 3

WIP port of Dunnet (Emacs text-based adventure) to Common Lisp

ColoradoSchoolOfMines/debannerizer 2

A Python tool for scraping class schedules from the Mines Self-Service Banner system into a database.

ColoradoSchoolOfMines/dec 2

DECTECH Webpages (tech.mines.edu)

jackrosenthal/csmdirsearch 2

Search the Mines directory

jackrosenthal/ec-zephyr-build 2

Hack to use EC makefile for Zephyr on Kukui EC PoC. Paste in zephyrproject directory, build zephyr and run make in EC directory

jackrosenthal/busraffle 1

Script for running a raffle of n identical items

push eventjackrosenthal/threelayout

cboushehri

commit sha 52b452f332f3e7a6588230d359fe23abd1800caa

Add files via upload

view details

cboushehri

commit sha 80a05961287746b8b5117144801ba8f0ab7efb47

Create INSTALL.md

view details

cboushehri

commit sha c55c792c1a63dad62c4e2f3d6b7c14a8e0435bf6

Update INSTALL.md

view details

cboushehri

commit sha 8b4f73b27cfe6c25a3fe2fa4b174e002b7c54cd9

Add files via upload

view details

cboushehri

commit sha c1132019c2d2cf787c296a462cd286198f84b672

Update INSTALL.md

view details

cboushehri

commit sha c708e0728e96401b587bc5fbe038f42c4ebc20f4

Delete KeyboardVerify.log

view details

cboushehri

commit sha d62dd6d369727dc296b41dcf463000ee2e41eb40

Update INSTALL.md

view details

cboushehri

commit sha 0b0a33ba2df86ce7f333ba94bf77c16e4d6186ab

Capital Q and F were missing for some reason

view details

cboushehri

commit sha 15bf83d39adbabb690d39288c0b54d9b44b2e57e

Add 9front to readme

view details

cboushehri

commit sha dddfab638f0df3bfbf2c44741c82e5f3725353ff

Remove old Windows files.

view details

cboushehri

commit sha 2f15b0b2ae5122c07cb57ed0c527bf1384d0e9f1

Add layout files for 9front

view details

cboushehri

commit sha 6f068947e3e97f8f16f5d8ef2d71ef6858223ea8

Remove redundant lines.

view details

cboushehri

commit sha a0a509e214003b1f284d80eccdb5f70bf680e80e

Fix cursor keys

view details

cboushehri

commit sha bff3245adf14e5eb452925632adafd6c6b6ab29f

Fix installation instructions

view details

cboushehri

commit sha e5eb8d09d5c2d5e7f3ae30615e549f656269c0fd

Add delete key

view details

cboushehri

commit sha 6a9409d1303d629c68ab0f7d445f85a05669e54a

Remove neo2 mod key

view details

push time in 5 days

PR merged jackrosenthal/threelayout

Add support for 9front

This patch adds support for 3l on 9front (http://9front.org/), a fork of Plan 9 from Bell Labs.

+216 -0

0 comment

2 changed files

cboushehri

pr closed time in 5 days

PullRequestReviewEvent

push eventjackrosenthal/kajiki

Deployment Bot (from Travis CI)

commit sha 0e4d1bb49d34e7ea9bd30329982045be5a208d94

Deploy docs.kajiki.io to github.com/jackrosenthal/kajiki.git:gh-pages

view details

push time in 5 days

pull request commentjackrosenthal/kajiki

Be careful not to insert a DTD before an `<?xml ...?>` declaration

Thank you for the contribution. Much appreciated!

frou

comment created time in 5 days

PR merged jackrosenthal/kajiki

Be careful not to insert a DTD before an `<?xml ...?>` declaration

Fixes #48

I just added to the doctest formatted comment that was already there.

python3 -m doctest -v kajiki/doctype.py

+48 -3

0 comment

1 changed file

frou

pr closed time in 5 days

push eventjackrosenthal/kajiki

Duncan Holm

commit sha a29e9c95f74bd33fa6025687a4e1988bb255a204

Be careful not to insert a DTD before an `<?xml ...?>` declaration Fixes #48

view details

Duncan Holm

commit sha db9c9dbebd1122a122539bcd5c5924677e4779d6

Keep `black` and `flake8` happy

view details

push time in 5 days

issue closedjackrosenthal/kajiki

XML template with declaration <?xml version="1.0"?> becomes invalid due to internal Kajiki manipulation

I use xmllint --format to automatically format XML files (much like black for Python code, csscomb for CSS, etc).

That autoformatter always inserts <?xml version="1.0"?> at the beginning of the XML file, which as far as I know is perfectly valid thing to do and is called the XML declaration:

<?xml version="1.0"?>
<html>
  <head>
    ...

The issue is that some internal manipulation of the XML by Kajiki inserts a custom DOCTYPE before that XML-Declaration, rather than after it, making the XML invalid:

kajiki.xml_template.XMLTemplateParseError: [resources/templates/home.xml:1] XML or text declaration not at start of entity
	     
	 --> <!DOCTYPE kajiki SYSTEM "kajiki.dtd"><?xml version="1.0"?>
	     <html>
	       <head>

If the result of the manipulation was instead:

<?xml version="1.0"?><!DOCTYPE kajiki SYSTEM "kajiki.dtd">
...

or:

<?xml version="1.0"?>
<!DOCTYPE kajiki SYSTEM "kajiki.dtd">
...

...then presumably the XML would still be valid and the template parsing would succeed.

closed time in 5 days

frou
PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

+/*+ * Copyright 2021 Google LLC+ *+ * SPDX-License-Identifier: Apache-2.0+ */++#ifndef TESTS_ZTEST_REGISTER_INCLUDE_COMMON_H_+#define TESTS_ZTEST_REGISTER_INCLUDE_COMMON_H_++#include <stdbool.h>++enum phase {+	PHASE_VERIFY,+	PHASE_NULL_PRAGMA_0,+	PHASE_NULL_PRAGMA_1,+	PHASE_STEPS_0,+	PHASE_STEPS_1,+};+struct state {

I assume this header can be included from pretty much anywhere?

"struct state" seems like a style violation ... https://www.kernel.org/doc/html/v5.12/process/coding-style.html#naming

yperess

comment created time in 21 days

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

  ZEPHYR_BASE = os.getenv("ZEPHYR_BASE") sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/twister"))-from twisterlib import TestInstance, BuildError, TestCase, TwisterException+from twisterlib import TestInstance, BuildError, TestCase, TwisterException, \+    ScanPathResult

use parenthesis to break lines (PEP-8)

yperess

comment created time in 21 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventjackrosenthal/dotfiles

Jack Rosenthal

commit sha f44e0b68a4aa09711274c55a8c51226361198ef7

emacs: update repo-transient config

view details

push time in 17 days

PullRequestReviewEvent

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 struct unit_test { 	uint32_t thread_options; }; -void z_ztest_run_test_suite(const char *name, struct unit_test *suite);+/**+ * Metadata about a ztest suite+ */+struct ztest_suite_metadata {+	uint32_t run_count;+	uint32_t skip_count;+	uint32_t fail_count;+};++/**+ * A single node of test suite. Each node should be added to a single linker section which will+ * allow ztest_run_registered_test_suites() to iterate over the various nodes.+ */+struct ztest_suite_node {+	/** The name of the test suite. */+	const char *name;+	/** Pointer to the test suite. */+	struct unit_test *suite;+	/**+	 * An optional pragma function to determine if the test should run. If NULL, then the test+	 * will only run once on the first attempt.+	 */+	bool (*pragma)(const void *state);+	/** Metadata */+	struct ztest_suite_metadata metadata;+};++extern struct ztest_suite_node _ztest_suite_node_list_start[];+extern struct ztest_suite_node _ztest_suite_node_list_end[];++/**+ * Create and register a ztest suite. Using this macro creates a new test suite (using+ * ztest_test_suite). It then creates a struct ztest_suite_node in a specific linker section.+ *+ * Tests can then be run by calling ztest_run_registered_test_suites(const void *state) by passing+ * in the current state. See the documentation for ztest_run_registered_test_suites for more info.+ *+ * @param SUITE_NAME The name of the suite (see ztest_test_suite for more info)+ * @param PRAGMA A function to test against the state and determine if the test should run.+ */+#define ztest_register_test_suite(SUITE_NAME, PRAGMA, ...)                                         \+	ztest_test_suite(SUITE_NAME, __VA_ARGS__);                                                 \

name the variable arguments and use ## to concatenate

#define ... (SUITE_NAME, PRAGMA, args...)
ztest_test_suite(SUITE_NAME, ##args)

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 def scan_file(inf_name):              with contextlib.closing(mmap.mmap(**mmap_args)) as main_c:                 suite_regex_match = suite_regex.search(main_c)-                if not suite_regex_match:+                registered_suite_regex_match = registered_suite_regex.search(+                    main_c)++                if registered_suite_regex_match:+                    has_registered_test_suites = True+                if registered_suite_run_regex.search(main_c):+                    has_run_registered_test_suites = True+                if test_main_regex.search(main_c):+                    has_test_main = True++                if not suite_regex_match and not has_registered_test_suites:                     # can't find ztest_test_suite, maybe a client, because                     # it includes ztest.h-                    return None, None+                    return None, None, has_registered_test_suites, \+                           has_run_registered_test_suites, has_test_main                  suite_run_match = suite_run_regex.search(main_c)-                if not suite_run_match:+                if suite_regex_match and not suite_run_match:                     raise ValueError("can't find ztest_run_test_suite") +                if suite_regex_match:+                    search_start = suite_regex_match.end()+                else:+                    search_start = registered_suite_regex_match.end()++                if suite_run_match:+                    search_end = suite_run_match.start()+                else:+                    search_end = re.compile(br"\);", re.MULTILINE) \+                        .search(main_c, search_start) \+                        .end()                 achtung_matches = re.findall(                     achtung_regex,-                    main_c[suite_regex_match.end():suite_run_match.start()])+                    main_c[search_start:search_end])                 if achtung_matches:                     warnings = "found invalid %s in ztest_test_suite()" \                                % ", ".join(sorted({match.decode() for match in achtung_matches},reverse = True))                 _matches = re.findall(                     stc_regex,-                    main_c[suite_regex_match.end():suite_run_match.start()])+                    main_c[search_start:search_end])                 for match in _matches:                     if not match.decode().startswith("test_"):                         warnings = "Found a test that does not start with test_"                 matches = [match.decode().replace("test_", "", 1) for match in _matches]-                return matches, warnings+                return matches, warnings, has_registered_test_suites, \+                       has_run_registered_test_suites, has_test_main      def scan_path(self, path):         subcases = []+        has_registered_test_suites = False+        has_run_registered_test_suites = False+        has_test_main = False         for filename in glob.glob(os.path.join(path, "src", "*.c*")):             try:-                _subcases, warnings = self.scan_file(filename)+                _subcases, warnings, _has_registered_test_suites, \+                    _has_run_registered_test_suites, _has_test_main = \+                    self.scan_file(filename)                 if warnings:                     logger.error("%s: %s" % (filename, warnings))                     raise TwisterRuntimeError("%s: %s" % (filename, warnings))                 if _subcases:                     subcases += _subcases+                if _has_registered_test_suites:+                    has_registered_test_suites = True+                if _has_run_registered_test_suites:+                    has_run_registered_test_suites = True+                if _has_test_main:+                    has_test_main = True             except ValueError as e:                 logger.error("%s: can't find: %s" % (filename, e))          for filename in glob.glob(os.path.join(path, "*.c")):             try:-                _subcases, warnings = self.scan_file(filename)+                _subcases, warnings, _, _, _ = self.scan_file(filename)                 if warnings:                     logger.error("%s: %s" % (filename, warnings))                 if _subcases:                     subcases += _subcases             except ValueError as e:                 logger.error("%s: can't find: %s" % (filename, e))++        if has_registered_test_suites and has_test_main and \

prefer parenthesis to \

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

+/*+ * Copyright 2021 Google LLC+ *+ * SPDX-License-Identifier: Apache-2.0+ */++#include <string.h>+#include <ztest.h>+#include "common.h"++#define num_registered_suites (_ztest_suite_node_list_end - _ztest_suite_node_list_start)++/** The current state of the test application. */+static struct state global_state;++/**+ * Copies of the nodes' snapshot, used to test assertions. There's no good way to get the number of+ * registered test suites at compile time so this is set to an arbitrary large size that should be+ * enough even if the number of tests grows. There's a runtime check for this in verify_execution.+ */+static struct ztest_suite_metadata metadata_snapshot[128];++/** The results of a single execution. */+struct execution_results {+	/** The test phase that was run. */+	enum phase test_phase;+	/** The number of tests that ran. */+	int test_run_count;+} execution_results;++/**+ * Helper function used to find a node by name.

replace "node" with "test entry" (globally)

node is very vague

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

+/*+ * Copyright 2021 Google LLC+ *+ * SPDX-License-Identifier: Apache-2.0+ */++#include <string.h>+#include <ztest.h>+#include "common.h"++#define num_registered_suites (_ztest_suite_node_list_end - _ztest_suite_node_list_start)++/** The current state of the test application. */+static struct state global_state;++/**+ * Copies of the nodes' snapshot, used to test assertions. There's no good way to get the number of+ * registered test suites at compile time so this is set to an arbitrary large size that should be+ * enough even if the number of tests grows. There's a runtime check for this in verify_execution.+ */+static struct ztest_suite_metadata metadata_snapshot[128];++/** The results of a single execution. */+struct execution_results {+	/** The test phase that was run. */+	enum phase test_phase;+	/** The number of tests that ran. */+	int test_run_count;+} execution_results;++/**+ * Helper function used to find a node by name.+ *+ * @param node_name The name of the node.+ * @return Pointer to the struct unit_test_node or NULL if not found.+ */+static struct ztest_suite_node *find_test_node(const char *node_name)+{+	struct ztest_suite_node *ptr;++	for (ptr = _ztest_suite_node_list_start; ptr != _ztest_suite_node_list_end; ++ptr) {+		if (strcmp(ptr->name, node_name) == 0) {+			return ptr;+		}+	}++	return NULL;+}++/**+ * Find a snapshot in the metadata_snapshot array.+ *+ * @param node_name The name of the test suite node.+ * @return Pointer to the metadata snapshot.+ */+static struct ztest_suite_metadata *find_snapshot(const char *node_name)+{+	int index = find_test_node(node_name) - _ztest_suite_node_list_start;++	return metadata_snapshot + index;+}++/**+ * Reset the global state between phases. This function can be thought of similarly to making a+ * change affecting the state of the application being tested.+ *+ * @param phase The new phase of the application.+ */+static void reset_state(enum phase phase)+{+	execution_results.test_phase = phase;+	execution_results.test_run_count = 0;+	global_state.phase = phase;++	for (int i = 0; i < num_registered_suites; ++i) {+		memcpy(metadata_snapshot + i, &(_ztest_suite_node_list_start + i)->metadata,+		       sizeof(struct ztest_suite_metadata));+	}+}++/**+ * Create a snapshot of the tests' metadata. This function should be called after each run in order+ * to assert on only the changes in the metadata.+ */+static void take_metadata_snapshot(void)+{+	for (int i = 0; i < num_registered_suites; ++i) {+		struct ztest_suite_metadata *snapshot = metadata_snapshot + i;+		struct ztest_suite_metadata *current = &_ztest_suite_node_list_start[i].metadata;++		snapshot->run_count = current->run_count - snapshot->run_count;+		snapshot->skip_count = current->skip_count - snapshot->skip_count;+		snapshot->fail_count = current->fail_count - snapshot->fail_count;+	}+}++static void verify_execution(void)+{+	const struct ztest_suite_metadata *metadata;++	zassert_true(ARRAY_SIZE(metadata_snapshot) >= num_registered_suites,+		     "Not enough metadata snapshots, please allocate more.");+	switch (execution_results.test_phase) {

this switch is unruly

recommend refactoring into functions ... pass a function pointer instead of an enum

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 def scan_file(inf_name):             # line--as we only search starting the end of this match             br"^\s*ztest_test_suite\(\s*(?P<suite_name>[a-zA-Z0-9_]+)\s*,",             re.MULTILINE)+        registered_suite_regex = re.compile(+            br"^\s*ztest_register_test_suite"+            br"\(\s*(?P<suite_name>[a-zA-Z0-9_]+)\s*,",+            re.MULTILINE)+        test_main_regex = re.compile(+            br"^\s*void\s*test_main\(void\)",+            re.MULTILINE)         stc_regex = re.compile(             br"^\s*"  # empy space at the beginning is ok             # catch the case where it is declared in the same sentence, e.g:             #             # ztest_test_suite(mutex_complex, ztest_user_unit_test(TESTNAME));-            br"(?:ztest_test_suite\([a-zA-Z0-9_]+,\s*)?"+            # ztest_register_test_suite(n, p, ztest_user_unit_test(TESTNAME),+            br"(?:ztest_"+            br"(?:test_suite\(|"+            br"register_test_suite\([a-zA-Z0-9_]+\s*,\s*"+            br")[a-zA-Z0-9_]+\s*,\s*)?"

this regex is getting a little bit out of hand.

would recommend using re.VERBOSE so that it can be made readable with comments and such

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 def scan_file(inf_name):              with contextlib.closing(mmap.mmap(**mmap_args)) as main_c:                 suite_regex_match = suite_regex.search(main_c)-                if not suite_regex_match:+                registered_suite_regex_match = registered_suite_regex.search(+                    main_c)++                if registered_suite_regex_match:+                    has_registered_test_suites = True+                if registered_suite_run_regex.search(main_c):+                    has_run_registered_test_suites = True+                if test_main_regex.search(main_c):+                    has_test_main = True++                if not suite_regex_match and not has_registered_test_suites:                     # can't find ztest_test_suite, maybe a client, because                     # it includes ztest.h-                    return None, None+                    return None, None, has_registered_test_suites, \+                           has_run_registered_test_suites, has_test_main                  suite_run_match = suite_run_regex.search(main_c)-                if not suite_run_match:+                if suite_regex_match and not suite_run_match:                     raise ValueError("can't find ztest_run_test_suite") +                if suite_regex_match:+                    search_start = suite_regex_match.end()+                else:+                    search_start = registered_suite_regex_match.end()++                if suite_run_match:+                    search_end = suite_run_match.start()+                else:+                    search_end = re.compile(br"\);", re.MULTILINE) \+                        .search(main_c, search_start) \+                        .end()                 achtung_matches = re.findall(                     achtung_regex,-                    main_c[suite_regex_match.end():suite_run_match.start()])+                    main_c[search_start:search_end])                 if achtung_matches:                     warnings = "found invalid %s in ztest_test_suite()" \                                % ", ".join(sorted({match.decode() for match in achtung_matches},reverse = True))                 _matches = re.findall(                     stc_regex,-                    main_c[suite_regex_match.end():suite_run_match.start()])+                    main_c[search_start:search_end])                 for match in _matches:                     if not match.decode().startswith("test_"):                         warnings = "Found a test that does not start with test_"                 matches = [match.decode().replace("test_", "", 1) for match in _matches]-                return matches, warnings+                return matches, warnings, has_registered_test_suites, \+                       has_run_registered_test_suites, has_test_main      def scan_path(self, path):         subcases = []+        has_registered_test_suites = False+        has_run_registered_test_suites = False+        has_test_main = False         for filename in glob.glob(os.path.join(path, "src", "*.c*")):             try:-                _subcases, warnings = self.scan_file(filename)+                _subcases, warnings, _has_registered_test_suites, \+                    _has_run_registered_test_suites, _has_test_main = \+                    self.scan_file(filename)                 if warnings:                     logger.error("%s: %s" % (filename, warnings))                     raise TwisterRuntimeError("%s: %s" % (filename, warnings))                 if _subcases:                     subcases += _subcases+                if _has_registered_test_suites:+                    has_registered_test_suites = True+                if _has_run_registered_test_suites:+                    has_run_registered_test_suites = True+                if _has_test_main:+                    has_test_main = True             except ValueError as e:                 logger.error("%s: can't find: %s" % (filename, e))          for filename in glob.glob(os.path.join(path, "*.c")):             try:-                _subcases, warnings = self.scan_file(filename)+                _subcases, warnings, _, _, _ = self.scan_file(filename)                 if warnings:                     logger.error("%s: %s" % (filename, warnings))                 if _subcases:                     subcases += _subcases             except ValueError as e:                 logger.error("%s: can't find: %s" % (filename, e))++        if has_registered_test_suites and has_test_main and \+            not has_run_registered_test_suites:

continuation indent should be differing from indentation of section below (PEP-8)

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 def scan_file(inf_name):              with contextlib.closing(mmap.mmap(**mmap_args)) as main_c:                 suite_regex_match = suite_regex.search(main_c)-                if not suite_regex_match:+                registered_suite_regex_match = registered_suite_regex.search(+                    main_c)++                if registered_suite_regex_match:+                    has_registered_test_suites = True+                if registered_suite_run_regex.search(main_c):+                    has_run_registered_test_suites = True+                if test_main_regex.search(main_c):+                    has_test_main = True++                if not suite_regex_match and not has_registered_test_suites:                     # can't find ztest_test_suite, maybe a client, because                     # it includes ztest.h-                    return None, None+                    return None, None, has_registered_test_suites, \

5 return values is excessive

refactor to a named tuple?

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 target_compile_options(testbinary PRIVATE   $<$<COMPILE_LANGUAGE:ASM>:${EXTRA_AFLAGS_AS_LIST}>   ) +target_link_options(testbinary PRIVATE+  -T ${ZEPHYR_BASE}/subsys/testsuite/include/ztest.ld

quote "${ZEPHYR_BASE}/subsys/..."

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 def scan_file(inf_name):              with contextlib.closing(mmap.mmap(**mmap_args)) as main_c:                 suite_regex_match = suite_regex.search(main_c)-                if not suite_regex_match:+                registered_suite_regex_match = registered_suite_regex.search(+                    main_c)++                if registered_suite_regex_match:+                    has_registered_test_suites = True+                if registered_suite_run_regex.search(main_c):+                    has_run_registered_test_suites = True+                if test_main_regex.search(main_c):+                    has_test_main = True++                if not suite_regex_match and not has_registered_test_suites:                     # can't find ztest_test_suite, maybe a client, because                     # it includes ztest.h-                    return None, None+                    return None, None, has_registered_test_suites, \

prefer parenthesis to \ for multiline statements (PEP-8)

yperess

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

ztest: Add register functionality

 def scan_file(inf_name):              with contextlib.closing(mmap.mmap(**mmap_args)) as main_c:                 suite_regex_match = suite_regex.search(main_c)-                if not suite_regex_match:+                registered_suite_regex_match = registered_suite_regex.search(+                    main_c)++                if registered_suite_regex_match:+                    has_registered_test_suites = True+                if registered_suite_run_regex.search(main_c):+                    has_run_registered_test_suites = True+                if test_main_regex.search(main_c):+                    has_test_main = True++                if not suite_regex_match and not has_registered_test_suites:                     # can't find ztest_test_suite, maybe a client, because                     # it includes ztest.h-                    return None, None+                    return None, None, has_registered_test_suites, \+                           has_run_registered_test_suites, has_test_main                  suite_run_match = suite_run_regex.search(main_c)-                if not suite_run_match:+                if suite_regex_match and not suite_run_match:                     raise ValueError("can't find ztest_run_test_suite") +                if suite_regex_match:+                    search_start = suite_regex_match.end()+                else:+                    search_start = registered_suite_regex_match.end()++                if suite_run_match:+                    search_end = suite_run_match.start()+                else:+                    search_end = re.compile(br"\);", re.MULTILINE) \+                        .search(main_c, search_start) \+                        .end()                 achtung_matches = re.findall(                     achtung_regex,-                    main_c[suite_regex_match.end():suite_run_match.start()])+                    main_c[search_start:search_end])                 if achtung_matches:                     warnings = "found invalid %s in ztest_test_suite()" \                                % ", ".join(sorted({match.decode() for match in achtung_matches},reverse = True))                 _matches = re.findall(                     stc_regex,-                    main_c[suite_regex_match.end():suite_run_match.start()])+                    main_c[search_start:search_end])                 for match in _matches:                     if not match.decode().startswith("test_"):                         warnings = "Found a test that does not start with test_"                 matches = [match.decode().replace("test_", "", 1) for match in _matches]-                return matches, warnings+                return matches, warnings, has_registered_test_suites, \+                       has_run_registered_test_suites, has_test_main      def scan_path(self, path):         subcases = []+        has_registered_test_suites = False+        has_run_registered_test_suites = False+        has_test_main = False         for filename in glob.glob(os.path.join(path, "src", "*.c*")):             try:-                _subcases, warnings = self.scan_file(filename)+                _subcases, warnings, _has_registered_test_suites, \+                    _has_run_registered_test_suites, _has_test_main = \+                    self.scan_file(filename)                 if warnings:                     logger.error("%s: %s" % (filename, warnings))                     raise TwisterRuntimeError("%s: %s" % (filename, warnings))                 if _subcases:                     subcases += _subcases+                if _has_registered_test_suites:+                    has_registered_test_suites = True+                if _has_run_registered_test_suites:+                    has_run_registered_test_suites = True+                if _has_test_main:+                    has_test_main = True             except ValueError as e:                 logger.error("%s: can't find: %s" % (filename, e))          for filename in glob.glob(os.path.join(path, "*.c")):             try:-                _subcases, warnings = self.scan_file(filename)+                _subcases, warnings, _, _, _ = self.scan_file(filename)                 if warnings:                     logger.error("%s: %s" % (filename, warnings))                 if _subcases:                     subcases += _subcases             except ValueError as e:                 logger.error("%s: can't find: %s" % (filename, e))++        if has_registered_test_suites and has_test_main and \+            not has_run_registered_test_suites:+            warning = \

prefer parenthesis to \

yperess

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentzephyrproject-rtos/zephyr

Microchip: MEC172x: QMSPI driver

+# Microchip XEC QMSPI V2++# Copyright (c) 2021 Microchip Technology Inc.+# SPDX-License-Identifier: Apache-2.0++config SPI_XEC_QMSPI_V2

what is "v2" for?

the help does not explain it

scottwcpg

comment created time in a month

Pull request review commentzephyrproject-rtos/zephyr

Microchip: MEC172x: QMSPI driver

 static void brd_cfg_uart(struct pinmux_ports_t *pp) #endif } +#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi0), okay)++#if DT_PROP(DT_INST(0, microchip_xec_qmspi), port_sel) == 0+/* shared QMSPI port: Two chip selects, single, dual, or quad */+static void brd_cfg_qmspi(struct pinmux_ports_t *pp)+{+#if DT_PROP(DT_INST(0, microchip_xec_qmspi), chip_select) == 0

can the gpio port/pin be retreived from device tree so we don't need this ifdef?

scottwcpg

comment created time in a month